Jump to content

Problems With Top Aligning


rain13

Recommended Posts

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?post-29208-0-70360900-1319450013.png

Link to comment
Share on other sites

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...