christina_g Posted August 18, 2014 Share Posted August 18, 2014 Hello everybody, I've created a table in HTML and while layout and styling with CSS is working nicely, the text of the first cell is very slightly shifted towards the bottom and therefore not aligned with the rest of the text in the other cells. What is the reason for this and how can this issue be solved ? Thank you very much in advance ! Link to comment Share on other sites More sharing options...
niche Posted August 18, 2014 Share Posted August 18, 2014 Post your relevant code and we'll help you Link to comment Share on other sites More sharing options...
Ingolme Posted August 18, 2014 Share Posted August 18, 2014 That might be because the content in the table cell is centered vertically. Try setting the vertical-align CSS property to "top" Link to comment Share on other sites More sharing options...
christina_g Posted August 18, 2014 Author Share Posted August 18, 2014 'vertical-align: top' does the job, thank you very much ! Link to comment Share on other sites More sharing options...
happycodings Posted August 28, 2014 Share Posted August 28, 2014 (edited) Css table <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>Css Table</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><style type="text/css">* { margin: 0; padding: 0}.container { background-color: #998FCC; width: 800px; border: 1px solid gray;}* html .container { width: 820px;}.header { width: 800px; border-bottom: 1px solid blue;}.header ul { list-style: none}.header ul li { width: 160px; border-left: 1px solid red; float: left; font-weight: bold; padding-left: 2px;}* html .header ul li { width: 180px;}.data { width: 180px; float: left; padding-left: 2px;}* html .data { width: 182px;}.rowodd,.roweven { position: relative; width: 800px; border-top: 1px solid #000; background-color: pink;}.roweven { background-color: #f79455;}.clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden;}.clearfix { display: inline-block;}</style></head><body><div class="container clearfix"> <div class="header clearfix"> <ul> <li>Column 1</li> <li>Column 2</li> <li>Column 3</li> <li>Column 4</li> <li>Column 5</li> </ul></div> <div class="rowodd clearfix"> <div class="data"> <p>Company 1</p> <p>happycodings1</p> <p>happycodings2</p> <p>happycodings3</p> <p>happycodings4</p> </div> <div class="data"><p>paragraph</p></div> <div class="data"><p>paragraph</p></div> <div class="data"><p>paragraph</p></div> <div class="data"><p>paragraph</p></div> </div> <div class="roweven clearfix"> <div class="data"> <p>Company 1</p> <p>code example</p> <p>code example</p> <p>code example</p> <p>code example</p> </div> <div class="data"><p>java</p></div> <div class="data"><p>php</p></div> <div class="data"><p>android</p></div> <div class="data"><p>c++</p></div> </div> <div class="rowodd clearfix"> <div class="data"> <p>Company 1</p> <p>happy</p> <p>happy</p> <p>happy</p> <p>happy</p> </div> <div class="data"><p>codes</p></div> <div class="data"><p>codes</p></div> <div class="data"><p>codes</p></div> <div class="data"><p>codes</p></div> </div></div></body></html> Edited August 30, 2014 by Ingolme Advertising 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