|
| |
|
|
DaveX
Posts: 230 Joined: 5/4/2004 Status: offline
|
Two elements on same line - 7/17/2008 11:58:26
One thing I'm having a hard time with in CSS is the positioning rules. For instance, I've got two named elements at the top of my page one right under the other and then an "<hr>" under those. I want to put them both right above the line with one all the way to the left and one all the way to the right. I've played around with both relative and absolute positioning without much luck. Do I need to figure in percentages here?
|
|
|
|
TexasWebDevelopers
Posts: 722 Joined: 2/22/2002 From: Dallas, TX Status: offline
|
RE: Two elements on same line - 7/17/2008 14:32:53
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>css test</title> <style type="text/css"> <!-- body { font: 100% Verdana, Arial, Helvetica, sans-serif; background: #666666; margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */ padding: 0; text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */ color: #000000; } .wrapper #container { width: 780px; /* using 20px less than a full 800px width allows for browser chrome and avoids a horizontal scroll bar */ background: #FFFFFF; margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */ border: 1px solid #000000; text-align: left; /* this overrides the text-align: center on the body element. */ } .wrapper #sidebar_right { float: right; /* since this element is floated, a width must be given */ width: 360px; /* the actual width of this div, in standards-compliant browsers, or standards mode in Internet Explorer will include the padding and border in addition to the width */ background: #EBEBEB; } .wrapper #sidebar_left { margin-top: 0; margin-right: 380px; margin-bottom: 0; margin-left: 0; padding-top: 0; padding-right: 20px; padding-bottom: 0; padding-left: 20px; } .fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */ float: right; margin-left: 8px; } .fltlft { /* this class can be used to float an element left in your page */ float: left; margin-right: 8px; } .clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */ clear:both; height:0; font-size: 1px; line-height: 0px; } --> </style> <!--[if IE 5]> <style type="text/css"> /* place css box model fixes for IE 5* in this conditional comment */ .wrapper #sidebar_right { width: 220px; } </style> <![endif]--><!--[if IE]> <style type="text/css"> /* place css fixes for all versions of IE in this conditional comment */ .wrapper #sidebar_right { padding-top: 30px; } .wrapper #sidebar_left { zoom: 1; } /* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ </style> <![endif]--></head> <body class="wrapper"> <div id="container"> <div id="sidebar_right"> <h3>Sidebar right Content</h3> <!-- end #sidebar_right --></div> <div id="sidebar_left"> <h3>Sidebar left Content</h3> <!-- end #sidebar_left --></div> <!-- This clearing element should immediately follow the #sidebar_left div in order to force the #container div to contain all child floats --><br class="clearfloat" /> <hr /> <!-- end #container --></div> </body> </html>
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|