TJMAudio Posted October 5, 2008 Share Posted October 5, 2008 I am trying to learn how to do complete site designs with no tables, but am a complete beginner to CSS. I am having a problem with getting two divs to align on the same horizontal level, as you can see from this image: http://www.image-ant.org/files/c8098f952647b45e03e55eee71b7f762.jpg Here is my code: <!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Website</title> <style type="text/css"> body, td, a, p { font-family: arial,sans-serif; } body { background: url(images/top_stretch_bg.gif) repeat-x; font-size: 13px; margin: 3px 8px 2em; } #logo { margin-left: 15px; margin-top: 0; width: 250px; } div#container { margin-left: auto; margin-right: auto; width: 90%; } div#toprss { width: 100%; text-align:right; } </style> </head> <body> <div id="container"> <div id="logo"> <a href="/index.html" title=".com Home"> <img src="images/logo.gif" title=".com" border="0" /></a> </div> <div id="toprss"> <a href="#subscribe" title="Subscribe to .com"> <img src="images/rss_top_right.gif" title="Subscribe to .com" border="0" /></a> </div> </div> </html> The RSS feed needs to be at a margin-top: 0; but it drops down, due to the logo div being there. How do I fix this? Link to comment https://forums.phpfreaks.com/topic/127109-simple-css-question/ Share on other sites More sharing options...
dropfaith Posted October 5, 2008 Share Posted October 5, 2008 you need to use css floats http://www.tizag.com/cssT/float.php Link to comment https://forums.phpfreaks.com/topic/127109-simple-css-question/#findComment-657559 Share on other sites More sharing options...
CyberWoolf Posted October 14, 2008 Share Posted October 14, 2008 If you are trying to line up three div's in a row, try setting the first two to float: left; . If you leave the last div without a float it should work! .div1 { float: left; } .div2 { float: left; } .div 3 { } Link to comment https://forums.phpfreaks.com/topic/127109-simple-css-question/#findComment-665653 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.