rain13 Posted October 24, 2011 Share Posted October 24, 2011 Hello I tried playing around with vertical-align: top; but it didn't seem to help - abc123 is still in the middle, not at the top. Other problem I have is that I am forced to use border around div. If i remove border: 1px solid blue; then that div gets center aligned. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <style type="text/css"> div { background-color: #d0d0d0; vertical-align: top; border: 1px solid blue;} </style> </head> <body><table border="0"> <tbody> <tr> <td style="background-color: #000000; vertical-align: top;"> <div style="vertical-align: top;"><ul style="background-color: #ff0000"><li>abc123</li></ul></div> </td> </tr> </tbody></table> </body></html> I want it to look like that instead of what it looks like now. Anyone has ideas? Link to comment Share on other sites More sharing options...
Ingolme Posted October 24, 2011 Share Posted October 24, 2011 Is there a particular reason why you need a table there? Link to comment Share on other sites More sharing options...
rain13 Posted October 24, 2011 Author Share Posted October 24, 2011 yes. then I can have other cell next to it Here's image: Why ask? Does it mean I cant do it like that? Link to comment Share on other sites More sharing options...
dsonesuk Posted October 24, 2011 Share Posted October 24, 2011 most elements have default margins, padding and sometimes a text indent, and ul is one of them that has all of these try try <ul style="background-color: #ff0000; margin:0; padding:0; text-indent:0;"><li>abc123</li></ul> you may also want to add ul, li {list-style-type:none;} Link to comment Share on other sites More sharing options...
rain13 Posted October 24, 2011 Author Share Posted October 24, 2011 thank you, both codes are exactly what i need Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.