Ginas Posted May 19, 2012 Report Share Posted May 19, 2012 (edited) Hi, first, sorry for my English. I wanted to ask, how on the HTML 5 do text in the center? Thanks. Edited May 19, 2012 by Ginas 1 Link to comment Share on other sites More sharing options...
Don E Posted May 19, 2012 Report Share Posted May 19, 2012 You can use CSS to target an element/tag and apply text-align: center; to it. The "align" attribute was deprecated in HTML 4.01, and is not supported in HTML5. Link to comment Share on other sites More sharing options...
Ginas Posted May 19, 2012 Author Report Share Posted May 19, 2012 You can use CSS to target an element/tag and apply text-align: center; to it. The "align" attribute was deprecated in HTML 4.01, and is not supported in HTML5. Can you give me that code? Because I didn't found he, because "align" is much. Link to comment Share on other sites More sharing options...
Don E Posted May 19, 2012 Report Share Posted May 19, 2012 http://www.w3schools.com/cssref/pr_text_text-align.asp Link to comment Share on other sites More sharing options...
Ginas Posted May 19, 2012 Author Report Share Posted May 19, 2012 http://www.w3schools..._text-align.asp What if I want the image be to the center? My code: <h2>Text</h2> <ul><li><a href="link" alt="" width="150" height="95" /></a></li> </ul> Link to comment Share on other sites More sharing options...
eTianbun Posted May 19, 2012 Report Share Posted May 19, 2012 Your markup is wrong, there is no <img> tag there. Link to comment Share on other sites More sharing options...
Ginas Posted May 19, 2012 Author Report Share Posted May 19, 2012 Your markup is wrong, there is no <img> tag there. I made a mistake. Here's a good code: <h2>Text</h2> <ul><li><a href="link"><img src="image" alt="" width="150" height="95" /></a></li> </ul> Link to comment Share on other sites More sharing options...
eTianbun Posted May 19, 2012 Report Share Posted May 19, 2012 add: style='text-align:center' to the <li>. Link to comment Share on other sites More sharing options...
Ginas Posted May 19, 2012 Author Report Share Posted May 19, 2012 add:style='text-align:center' to the <li>. Where? <h2>Text</h2><ul><li><a href="link"><img src="image" alt="" width="150" height="95" /></a></li> </ul> Link to comment Share on other sites More sharing options...
dsonesuk Posted May 19, 2012 Report Share Posted May 19, 2012 the parent block element li which it is within<li style='text-align:center'> Link to comment Share on other sites More sharing options...
Guest So Called Posted May 19, 2012 Report Share Posted May 19, 2012 read "inline styles" http://www.w3schools.com/css/css_howto.asp Link to comment Share on other sites More sharing options...
Ginas Posted May 19, 2012 Author Report Share Posted May 19, 2012 the parent block element li which it is within<li style='text-align:center'> And if I want image in the center? What then? Link to comment Share on other sites More sharing options...
dsonesuk Posted May 19, 2012 Report Share Posted May 19, 2012 ??? img, and anchor element are by default inline, and would act as text, so if the anchor, image are not using float, are not using position absolute, are not turned into block elements themselves!, using text-align: center; on the parent block element, IF this element width is larger than the image width, and itself is not using float, or positioning WILL centre itself within this element. Link to comment Share on other sites More sharing options...
eTianbun Posted May 19, 2012 Report Share Posted May 19, 2012 It seems you are NEW to all this, but i want you to know it's pretty simple. Visit w3schools.com and check out CSS. Link to comment Share on other sites More sharing options...
ShadowMage Posted May 22, 2012 Report Share Posted May 22, 2012 And if I want image in the center? What then?Just try it out. I think you'll find the code that CodeName and dsonesuk provided does exactly what you want. 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