GoldSoft Posted August 26, 2014 Share Posted August 26, 2014 HiHow to place div in the center screen ?I dont know the screen resulation it canBe bog or small - but i need the div allways In the center screen. Link to comment Share on other sites More sharing options...
dsonesuk Posted August 26, 2014 Share Posted August 26, 2014 http://w3schools.invisionzone.com/index.php?showtopic=48809 Link to comment Share on other sites More sharing options...
srinivas g Posted September 7, 2014 Share Posted September 7, 2014 Here is the code u need .... <div style="text-align:center;" > write your text </div> Link to comment Share on other sites More sharing options...
dsonesuk Posted September 7, 2014 Share Posted September 7, 2014 Here is the code u need .... <div style="text-align:center;" > write your text </div>Which will place text in centre along top, but will not place DIV in centre horizontally and vertically. Link to comment Share on other sites More sharing options...
srinivas g Posted September 7, 2014 Share Posted September 7, 2014 Hi dsonesuk, it is center in horizontally and about vertically means height of ur webpage .. my code is for center regardless of height .. if u know the height u can adjust as u wish ... for each query there is a separate code... so DIV center that too horizontally until know the height Link to comment Share on other sites More sharing options...
srinivas g Posted September 7, 2014 Share Posted September 7, 2014 one more thing until define a width of a DIV the text inside the DIV is center if u want DIV center try this also <div align="center" style="background-color:#FF0000;"> Put your code here.. </div> Link to comment Share on other sites More sharing options...
dsonesuk Posted September 7, 2014 Share Posted September 7, 2014 Title of topic "Place div in the centre screen", NOT text, the div being a block element stretches to the width available to it, only the text is centred when text-align: center; is used and is not vertically aligned in centre/middle because the height of div is determined by content, so it will always appear at the top of browser window screen instead of vertically centre/middle, which is what the poster wants for DIV element to automatically without the need to specify height place itself in middle of screen and NOT TEXT! Link to comment Share on other sites More sharing options...
dsonesuk Posted September 7, 2014 Share Posted September 7, 2014 Extra one more thing, check out link in post# 2, in it you will see DIV given a width/height, without knowing height/width of browser window centring itself horizontally and vertically. Link to comment Share on other sites More sharing options...
dsonesuk Posted September 7, 2014 Share Posted September 7, 2014 one more thing until define a width of a DIV the text inside the DIV is center if u want DIV center try this also<div align="center" style="background-color:#FF0000;">Put your code here..</div>Again would ONLY CENTRE TEXT within any block element such as div, and will centre inline element such as anchor, but still not a DIV. Link to comment Share on other sites More sharing options...
srinivas g Posted September 8, 2014 Share Posted September 8, 2014 ok use <center> tag to align DIV center. By using <center> tags u can directly align DIV center not only elements inside the DIV .. check this it is possible..! Link to comment Share on other sites More sharing options...
srinivas g Posted September 8, 2014 Share Posted September 8, 2014 <center><div style="margin:50%;"> centered content </div></center> ..., define ur DIV width .. u will get DIV center screen not ONLY CENTRE TEXT...! Link to comment Share on other sites More sharing options...
Ingolme Posted September 8, 2014 Share Posted September 8, 2014 <center> is deprecated. Link to comment Share on other sites More sharing options...
srinivas g Posted September 8, 2014 Share Posted September 8, 2014 our aim is "place div in the center screen" my solution is use <center> tag so that we can put DIV into center n this is possible with center tag that's it ...! Whatever we need solution. That's all. Link to comment Share on other sites More sharing options...
dsonesuk Posted September 8, 2014 Share Posted September 8, 2014 (edited) 1) it does NOT! work anyway. 2) NO! the aim is to use current valid html, css to current standards. 3) http://w3schools.invisionzone.com/index.php?showtopic=48809 link which i have already provided, and pointed out to you before, has the solution or to be precise 3 solutions, all using valid html/css current standards. css 2 and css3. Edited September 8, 2014 by dsonesuk Link to comment Share on other sites More sharing options...
srinivas g Posted September 8, 2014 Share Posted September 8, 2014 ohh okay, i entered in the middle ... i agree. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now