CSS - Basic Layout Question - Floats, Other Elements
Good Day All,
I have a basic layout question. In this page, any many others, I have my image element floated to the left of a table. This seems to work well in big resolutions but when I view the page on smaller resolutions, the table gets pushed down below the image. In some cases, this is ok... but if I want to prevent this from happening and keep the img and table together to prevent the dropping, how can I do this? What is the cleanest/easiest way? In the example below, the 4th table from the top is the one that will drop first. Any thoughts greatly appreciated. Also, I would like to keep my liquid layout other than grouping these two items together - and I only need to apply this to a few of them, not all. http://029c92a.netsolhost.com/abrasives/cutmetalm.html Colin Similar TutorialsHi all, I've been struggling with a basic layout question for a while and I could use some direction as a recent CSS convert. Basically I have a two column layout contained within another div (for borders and colors). What is happening is that my container only grows vertically to the size of the right column regardless of the size of the the left. Is there a way to "attach" the containing div to which ever column is the tallest? I've setup a test page to show the problem. This occurs in I.E. 6.0 and Firefox 1.5.x (Windows and Unix). Thanks very much for any pointers. I'm having a problem where one div is expanding underneath another div that is floating right. The floating right div (right_sidebar) will not be on every page, so I want the other div (section_box) to expand full width when the floated div is not there. There will be many stacking #section_box divs that stack one on top of another. The above is how I would like my layout to work. How do I accomplish this? Well I am having serious problems with CSS floats. I created a design in Photoshop, sliced it and imported everything in Dreamweaver. So far, so good. However when you slice with Photoshop, you get a CSS with "position: absolute", which I am trying to avoid. However I managed to get the header partially correctly floated, but for some reason, it doesn't display correctly in Firefox. Not to mention Internet Explorer 8, which shows (empty) spaces everywhere (tried padding/margin 0px, but didn't do anything). Can someone take a quick peek and see what I am doing wrong here? And if possible correct the errors or tell me what I am doing wrong? Cause I am really hitting a brick wall at the moment. Here is the page: link Thanks in advance. //edit Okay I fixed the empty space problem in IE, I seem to have forgotten to set the doctype up correctly; my bad. But I am still having a problem with the floats. Hi, I have three <div> Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> </HEAD> <BODY> <div id="container" style="width:500px;height:700px;background-color:green;"> <div id="one" style="float:left;width:100px;background-color:#ff9900; ">one<br>one<br>one<br>one<br>one<br>one<br>one<br></div> <div id="three" style="float:right;width:100px;background-color:red;">three </div> <div id="two" style="float:left;width:70%;background-color:#ff9988;">two jdfk hnldncf ddhf sd ohdnfc kbldhcv ohsvnskd hvjnsdhv hviopsdhv kbhopvd v onksdnv oln;sdmnv m;mv mnml;vm vm;klf kdfl'gl;v 'fg 'kdf'kvb'l ;'lfk</div> </div> </BODY> </HTML> I noticed when I increased the % width of my <div two> it goes below my <div three> I was under the impression it should just stay at the same level and text should wrap around my div three? But I guess that's not the case. Am I doing the something wrong or is this the expected behavior? heya guys having some drama with what should be a simple task. basically i just want to expand the intro-left div to 100% without pushing the right hand content thats fixed. Code: <div id="intro" style="float:left; display:inline; border: 1px solid red; width:100%;"> <div id="intro-left" style='float:left; border:1px solid green; overflow:hidden; width:auto;'> text </div> <div id="feeder" style="float:right; border: 1px solid black; width:200px;height:400px;"> text </div> </div> I'm new to CSS and I am trying to create a style sheet for a website I am currently getting ready to begin production of and was trying to get my basic layout made up. I was wandering if you guys could help me out because I keep getting a few concepts mixed up as I am going along through creating this and can't quite get it set up the way I want to. I tried to comment my CSS so you guys could get a basic understanding of what I was aiming for. Don't worry about the odd backgrounds at the moment b/c I am just using them to easily identify my different divs. Anyway, here is my css: Code: /* CSS Document */ h1 { font-family: Geneva, Arial, sans-serif; font-size: 20px; color:#000000; } h2{ font-family: Geneva, Arial, sans-serif; font-size: 16px; color:#000000; } h4{ font-family: Geneva, Arial, sans-serif; font-size: 12px; color:#000000; } /*============================ Begin Layout Structure ============================*/ #wrapper { /* main container for everything */ width: 1014px; /* 1024px total with padding */ min-height: 748px; margin: 0 auto; background: #ffffff; overflow: hidden; /* contain inner floats */ position: relative; /* establish the containing block */ padding-right: 10px; } #accounttypeselector { /* select personal or business to affect page display */ position: absolute; width: 100%; height: 25px; left: 0; top: 0; padding: 0; background: #ff00ff; } #servicesbar { /* container for user services */ position: absolute; /* sitting up this way b/c will be contained within wrapper */ width: 100%; /* with absolute positoning and being inside wrapper should be 100% of width of wrapper */ height: 30px; /* 30px should be adequate height */ padding: 0; background: #ffffff; } #servicesbar-services { /* container for user services once logged in */ position: absolute; /* not sure if position for this is right - should be left side of servicesbar */ width: 75%; /* want it to be 75% of the servicesbar width */ height: 100%; /* since servicesbar container height is 30px should be 100% of this */ padding: 0; background: #ff00ff; } #servicesbar-login { /* for user login and logout - contained inside servicesbar */ position: absolute; /* not sure if position for this is right - should be right side of servicesbar */ width: 25%; /* want it to be 25% of the servicesbar width */ height: 100%; /* since servicesbar container height is 30px should be 100% of this */ } #header { /* will include site banner/logo */ width: 1024px; padding: 0; background: #ff0000; background-image: "background.gif"; /* if I don't specify a height will this div take on the height of the image? */ } #navmain { /* navbar that will be located below header */ width: 1024px; padding: 0; background: #21ee00; } #bodywrapper { /* wrapper for main content - will have 3 columns here */ width: 1024px; padding-top: 10; } #bodywrapper-navleft { /* sub nav to be lcoated in left column of bodywrapper */ width: 15%; background: #8B8378; padding: 0; } #bodywrapper-main { /* main content to be located in middle column of bodywrapper */ width: 70%; background: #66CDAA; padding:0; } #bodywrapper-news { /* news column to be located in right column of bodywrapper */ width: 15%; background: #8A2BE2; padding:0; } #footer { /* footer to be located at bottom of wrapper */ width: 1014px; /* will be 1024 with padding */ height: 20px; padding-right: 10px; } And here is just my bareboned html where I was trying to put my divs together: Code: <!DOCTYPE html> <html> <head> <title></title> <link rel="stylesheet" type="text/css" href="test2.css" /> </head> <body> <div id= "wrapper" > <div id= "accounttypeselector" > </div> <div id= "servicesbar" > <div id= "servicesbar-services" > </div> <div id= "servicesbar-login" > </div> </div> <div id= "header" > </div> <div id= "navmain" > </div> <div id= "bodywrapper" > <div id= "bodywrapper-navleft" > </div> <div id= "bodywrapper-main" > </div> <div id= "bodywrapper-news" > </div> </div> </div> <div id= "footer" > </div> </body> </html> Can anyone offer me some suggestions to straighten me out here and also any tips if I am doing anything that isn't the accepted norm. Thanks in advance and let me know if you have any questions as to what I am trying to do. Really appreciate it. Nathan Greetings: I need to essentially create a table out of DIV tags. The reason is because I need to grant the user the ability to use scrollbars to navigate in a given cell. The problem I am running into, is when the DIV elements fall outside of the wrapper DIV, they wrap to new lines. The DIV "table" within the HTML table is by design. This is because I cannot create a scrollable subset of elements within TD tags. I am simply looking for the way to ensure the following: 1. The DIV "cells" do not wrap (as they are now) and 2. Scrollbars exist to move horizontally and vertically within the "cell" I've experimented with all sorts of combinations of CSS in several of the elements to no avail. Thanks for any help. The HTML for the table: Code: <table id="optionsMatrixTable" border="1"> <thead id="optionsMatrixTableHead"> <!-- <tr id="optionsMatrixTableHeadRow"></tr> --> <tr class="menuRow" id="optionsMatrixMenuRow"> <td colspan="7"> <label><input type="checkbox" id="autoUpdateTrigger" name="autoUpdateTime"checked="checked" /> Live update every</label> <select id="autoUpdateTime" name="autoUpdateTime"><option value="15000" selected="selected">15</option><option value="30000">30</option><option value="60000">60</option><option value="90000">90</option><option value="120000">120</option></select> seconds | Add field <select id="fieldList" name="" style="width: 250px;"></select> </td> </tr> </thead> <tbody id="optionsMatrixTableBody"> <tr id="optionsMatrixTableBodyCallsRow"> <td colspan="7" id="optionsMatrixTableBodyCallsRowContainer"> <div id="callsRowContainer"> <div id="" class="matrixContainerHeader"><div class="matrixContainer">Calls</div><div class="matrixContainer" id="dec08">Dec (19)</div><div class="matrixContainer" id="jan09">Jan (47)</div><div class="matrixContainer" id="mar09">Mar (110)</div><div class="matrixContainer" id="jun09">Jun (201)</div><div class="matrixContainer" id="sep09">Sep (290)</div><div class="matrixContainer" id="dec09">Dec (380)</div></div> <div id="" class="matrixContainer">65 calls</div> <div id="" class="matrixContainer"> <div class="matrixItemWrapper top"><span class="matrixItem" title="Price">0.18</span><span class="matrixItem" title="Implied Volitility">47.56%</span><span class="matrixItem" title="Trade"><input type="text" name="" value="" class="" id="" size="4" maxlength="10" /></span></div> <div class="matrixItemWrapper bottom"><span class="matrixItem" title="Delta">68.05</span><span class="matrixItem" title="Theta">17.05</span><span class="matrixItem" title="Vega">26.05</span></div> </div> <div id="" class="matrixContainer"> <div class="matrixItemWrapper top"><span class="matrixItem" title="Price">0.18</span><span class="matrixItem" title="Implied Volitility">47.56%</span><span class="matrixItem" title="Trade"><input type="text" name="" value="" class="" id="" size="4" maxlength="10" /></span></div> <div class="matrixItemWrapper bottom"><span class="matrixItem" title="Delta">68.05</span><span class="matrixItem" title="Theta">17.05</span><span class="matrixItem" title="Vega">26.05</span></div> </div> <div id="" class="matrixContainer"> <div class="matrixItemWrapper top"><span class="matrixItem" title="Price">0.18</span><span class="matrixItem" title="Implied Volitility">47.56%</span><span class="matrixItem" title="Trade"><input type="text" name="" value="" class="" id="" size="4" maxlength="10" /></span></div> <div class="matrixItemWrapper bottom"><span class="matrixItem" title="Delta">68.05</span><span class="matrixItem" title="Theta">17.05</span><span class="matrixItem" title="Vega">26.05</span></div> </div> <div id="" class="matrixContainer"> <div class="matrixItemWrapper top"><span class="matrixItem" title="Price">0.18</span><span class="matrixItem" title="Implied Volitility">47.56%</span><span class="matrixItem" title="Trade"><input type="text" name="" value="" class="" id="" size="4" maxlength="10" /></span></div> <div class="matrixItemWrapper bottom"><span class="matrixItem" title="Delta">68.05</span><span class="matrixItem" title="Theta">17.05</span><span class="matrixItem" title="Vega">26.05</span></div> </div> <div id="" class="matrixContainer"> <div class="matrixItemWrapper top"><span class="matrixItem" title="Price">0.18</span><span class="matrixItem" title="Implied Volitility">47.56%</span><span class="matrixItem" title="Trade"><input type="text" name="" value="" class="" id="" size="4" maxlength="10" /></span></div> <div class="matrixItemWrapper bottom"><span class="matrixItem" title="Delta">68.05</span><span class="matrixItem" title="Theta">17.05</span><span class="matrixItem" title="Vega">26.05</span></div> </div> <div id="" class="matrixContainer"> <div class="matrixItemWrapper top"><span class="matrixItem" title="Price">0.18</span><span class="matrixItem" title="Implied Volitility">47.56%</span><span class="matrixItem" title="Trade"><input type="text" name="" value="" class="" id="" size="4" maxlength="10" /></span></div> <div class="matrixItemWrapper bottom"><span class="matrixItem" title="Delta">68.05</span><span class="matrixItem" title="Theta">17.05</span><span class="matrixItem" title="Vega">26.05</span></div> </div> <div id="" class="matrixContainerFooter"></div> </div> </td> </tr> <tr id="optionsMatrixTableBodyPutsContainer"> <td colspan="7" id="optionsMatrixTableBodyPutsRowContainer"> <div id="putsRowContainer"> <div id="" class="matrixContainerHeader"><span class="matrixContainer">Puts</span><span class="matrixContainer" id="dec08">Dec (19)</span><span class="matrixContainer" id="jan09">Jan (47)</span><span class="matrixContainer" id="mar09">Mar (110)</span><span class="matrixContainer" id="jun09">Jun (201)</span><span class="matrixContainer" id="sep09">Sep (290)</span><span class="matrixContainer" id="dec09">Dec (380)</span></div> <div id="" class="matrixContainer">65 calls</div> <div id="" class="matrixContainer"> <div class="matrixItemWrapper top"><span class="matrixItem" title="Price">0.18</span><span class="matrixItem" title="Implied Volitility">47.56%</span><span class="matrixItem" title="Trade"><input type="text" name="" value="" class="" id="" size="4" maxlength="10" /></span></div> <div class="matrixItemWrapper bottom"><span class="matrixItem" title="Delta">68.05</span><span class="matrixItem" title="Theta">17.05</span><span class="matrixItem" title="Vega">26.05</span></div> </div> <div id="" class="matrixContainer"> <div class="matrixItemWrapper top"><span class="matrixItem" title="Price">0.18</span><span class="matrixItem" title="Implied Volitility">47.56%</span><span class="matrixItem" title="Trade"><input type="text" name="" value="" class="" id="" size="4" maxlength="10" /></span></div> <div class="matrixItemWrapper bottom"><span class="matrixItem" title="Delta">68.05</span><span class="matrixItem" title="Theta">17.05</span><span class="matrixItem" title="Vega">26.05</span></div> </div> <div id="" class="matrixContainer"> <div class="matrixItemWrapper top"><span class="matrixItem" title="Price">0.18</span><span class="matrixItem" title="Implied Volitility">47.56%</span><span class="matrixItem" title="Trade"><input type="text" name="" value="" class="" id="" size="4" maxlength="10" /></span></div> <div class="matrixItemWrapper bottom"><span class="matrixItem" title="Delta">68.05</span><span class="matrixItem" title="Theta">17.05</span><span class="matrixItem" title="Vega">26.05</span></div> </div> <div id="" class="matrixContainer"> <div class="matrixItemWrapper top"><span class="matrixItem" title="Price">0.18</span><span class="matrixItem" title="Implied Volitility">47.56%</span><span class="matrixItem" title="Trade"><input type="text" name="" value="" class="" id="" size="4" maxlength="10" /></span></div> <div class="matrixItemWrapper bottom"><span class="matrixItem" title="Delta">68.05</span><span class="matrixItem" title="Theta">17.05</span><span class="matrixItem" title="Vega">26.05</span></div> </div> <div id="" class="matrixContainer"> <div class="matrixItemWrapper top"><span class="matrixItem" title="Price">0.18</span><span class="matrixItem" title="Implied Volitility">47.56%</span><span class="matrixItem" title="Trade"><input type="text" name="" value="" class="" id="" size="4" maxlength="10" /></span></div> <div class="matrixItemWrapper bottom"><span class="matrixItem" title="Delta">68.05</span><span class="matrixItem" title="Theta">17.05</span><span class="matrixItem" title="Vega">26.05</span></div> </div> <div id="" class="matrixContainer"> <div class="matrixItemWrapper top"><span class="matrixItem" title="Price">0.18</span><span class="matrixItem" title="Implied Volitility">47.56%</span><span class="matrixItem" title="Trade"><input type="text" name="" value="" class="" id="" size="4" maxlength="10" /></span></div> <div class="matrixItemWrapper bottom"><span class="matrixItem" title="Delta">68.05</span><span class="matrixItem" title="Theta">17.05</span><span class="matrixItem" title="Vega">26.05</span></div> </div> <div id="" class="matrixContainerFooter"></div> </div> </td> </tr> </tbody> <tfoot> <tr class="menuRow" id="optionsMatrixEquityInformation"> <td colspan="7">Underlying: MSFT | Last: 20.83 | Change: 1.93 (0.96%)</td> </tr> </tfoot> </table> And the CSS: Code: #optionsMatrixContainer { border: 1px solid #000; } thead { font-weight: bold; } .menuRow { background-color: #999; } .loading { background-color:#FFFFCC; font-size: 80% } .matrixItem { padding: 0 5px 0 5px; } .matrixContainer { border: 1px solid #000; width: 175px; float: left; margin: 1px} .matrixContainerHeader { clear: both; } .matrixContainerFooter { clear: both; } .matrixItemWrapper { padding: 0; margin: 0; } .top { border-bottom: 0px; } .bottom { border-top: 1px dashed #000; } #callsRowContainer, #putsRowContainer { overflow: scroll; white-space: nowrap; display: block; float: left; clear: right; } CSS newb here and this is my first full CSS page layout ever, so go easy. Some of the page elements do not stretch properly to match the page content. I also tried to add a few bits to make a sticky footer, and in doing so I sort of confused myself as to where the problem is. Here's a link to the page: http://www.crackin.com/cbled/index.html and here's the code: Code: body {font: 75% Verdana, Arial, Helvetica, sans-serif;background: #FFFFFF;margin: 0;padding: 0;text-align: center;color: #000000;height: 100%;} html {height: 100%;} * html #nonFooter {height: 100%;} .oneColFixCtr #nonFooter {width: 923px;background: #FFFFFF;margin: 0 auto;border: none;text-align: left;position: relative;min-height: 100%;z-index:3;} .oneColFixCtr #content {padding: 0 0 56 0; height:auto;} #mainlayout {position:relative;left:0px;top:0px;width:923px;} #liberty-header {position:absolute;left:231px;top:0px;width:114px;height:151px;} #logo-orb {position:absolute;left:0px;top:24px;width:231px;height:156px;} #header-slogan {position:absolute;left:231px;top:151px;width:692px;height:29px;} #logo-ledind {position:absolute;left:0px;top:180px;width:231px;height:66px;} #header-breaktop {position:absolute;left:231px;top:180px;width:692px;height:66px;} #header-breakbase {position:absolute;left:0px;top:246px;width:923px;height:57px;} #liberty-main {position:absolute;left:211px;top:303px;width:366px;height:409px;} #navbarbreak {position:absolute;left:231px;margin-top:10px;width:2px;height:95%;background-color:#BBB; z-index:2;} #pagecontent {position:absolute;left:253px;top:303px;width:650px;height:10px;} #navbar {position:absolute;left:0px;top:303px;width:233px;height:350px;} #navbar-home {float:left;margin-top:15px;width:100%;text-align:right;z-index:1;font-weight:bold;font-size:110%;} #navbar-info {float:left;margin-top:5px;width:100%;text-align:right;z-index:1;font-weight:bold;font-size:110%;} #navbar-link3 {float:left;margin-top:5px;width:100%;text-align:right;z-index:1;font-weight:bold;font-size:110%;} #navbar-link4 {float:left;margin-top:5px;width:100%;text-align:right;z-index:1;font-weight:bold;font-size:110%;} #navbar a {display:block;width:100%;height:100%;text-decoration:none;color:#333;background-color:#EEE;padding:4px 0px;} #navbar a:hover {background-color:#9ADF86;} #footer {position:relative;width: 923px;margin: -56px auto 0 auto;z-index:4;} #footer-left {position:absolute;left:31px;top:0px;width:18px;height:56px;} #footer-bg {position:absolute;left:49px;top:0px;width:825px;height:56px;background-color:#329428} #footer-right {position:absolute;left:874px;top:0px;width:18px;height:56px;} #greenbreak-z {z-index:1;} #greenbreak {position:absolute;left:0px;top:200px;width:100%;height:123px;background:url(images/mainbg_horiz.jpg);background-repeat:repeat-x;} #page-edges-a {position:absolute;left:0;top:0;width:100%;height:100%;z-index:2;} #page-edges-b {position:relative;margin:0 auto;width:923px;height:100%;} #mainbg-leftvert {position:absolute;left:-16px;top:0px;width:16px;height:100%;background:url(images/mainbg_leftvert.png);background-repeat:repeat-y;} #mainbg-rightvert {position:absolute;left:923px;top:0px;width:16px;height:100%;background:url(images/mainbg_rightvert.png);background-repeat:repeat-y;} #clear {clear:both;} --> </style></head> <body class="oneColFixCtr"> <div id="nonFooter"> <div id="content"> <div id="mainlayout"> <div id="liberty-header"><img src="images/liberty_header.jpg" width="114" height="151" alt=""></div> <div id="logo-orb"><img src="images/logo_orb.jpg" width="231" height="156" alt=""></div> <div id="header-slogan"><img src="images/header_slogan.png" width="692" height="29" alt=""></div> <div id="logo-ledind"><img src="images/logo_ledind.jpg" width="231" height="66" alt=""></div> <div id="header-breaktop"><img src="images/header_breaktop.jpg" width="692" height="66" alt=""></div> <div id="header-breakbase"><img src="images/header_breakbase.jpg" width="923" height="57" alt=""></div> <div id="liberty-main"><img src="images/liberty_main.jpg" width="366" height="409" alt=""></div> <div id="navbar"> <div id="navbar-home"><a href="#">home </a></div> <div id="navbar-info"><a href="#">company info </a></div> <div id="navbar-link3"><a href="#">link3 </a></div> <div id="navbar-link4"><a href="#">link4 </a></div> <div id="navbarbreak"></div> </div> <div id="pagecontent" align="justify"> <p>Lorem ipsum, etc etc...</p> </div> </div> </div> </div> <!--PAGE DROPSHADOW--> <div id="page-edges-a"> <div id="page-edges-b"> <div id="mainbg-leftvert"></div> <div id="mainbg-rightvert"></div> </div> </div> <!--GREEN BACKGROUND--> <div id="greenbreak-z"> <div id="greenbreak"></div> </div> <!--FOOTER--> <div id="footer"> <div id="footer-left"><img src="images/footer_left.gif" width="18" height="56" alt=""></div> <div id="footer-bg"></div> <div id="footer-right"><img src="images/footer_right.gif" width="18" height="56" alt=""></div> </div> </body> </html> Any help is much appreciated. Hi everybody I'm having a problem (only in IE) with the following layout http://www.ruthwhiteyoga.com/shop/test2/list.htm The left fixed width column, right fixed width column and centre stretchy column all sit inside a holding div (100% wide) The left column is floated left, the right column is floated right and the centre column has margin left and margin right values that clear the two floated columns The problem is that in IE the floated product divs (in the centre column) ignore the margin-right. As soon as the content ends in the right column the product divs spill into the area that the margin should be keeping them out of (you might need to alter the width of your window to see this happening) I think the problem is that I can't give the centre column a width (100%) because it also needs a margin to force the content in - 100% plus 230px for the left column plus 230px for the right column will totally screw up the page Beyond sticking these three columns into a table (something I really really don't want to do) or using percentage for all three columns (so I can give the centre column a width value) is there anything I can do about this. Really appreciate any help I have a CSS call for all p, like this p { font-family: Arial, Helvetica, sans-serif; font-size: 12pt; } now I want headings to be ital, so I add p.ital { font-style: italic; } and set the class for some p to ital, and they inherit font family and font size. Now I want further inherit, italBold p.italBold { font-weight: bold; } That is, I want p.italBold to inherit from p.ital, which inherits from p. How can I do this? Thanks for your help CJB I am new to this stuff started php about a month ago now i started with this css nav menu last week and can not figure out how to get the thing in the center of the page also in FF the nav menu is fine just not in the right location in IE the bottom half of the nav menu sticks out one inch past the top half here is my css PHP Code: #divNav { background: transparent url(../images/bk-nav.jpg) no-repeat top left; margin: 0; padding: 0; height: 80px; width: 800px; } #nav { position: relative; top: 55px; height: 80px; width: 800px; } #nav li ul, #nav li ul { margin: 0; padding: 0; } #nav a { text-decoration: none; } #nav li { /*float the main list items*/ margin: 0; float: left; display: block; padding-right: 15px; } #nav li ul { display: none; } #nav li.off ul, #nav li.on ul { /*put the subnav below*/ position: absolute; top: 25px; left: 0; padding-top: 15px; background: #224d6f; height: 28px; width: 740px; padding-left: 60px; } #nav li.on ul { background: #f90; } #nav li.on:hover ul, #nav li.over ul { /*for ie*/ background: #224d6f; } #nav li a { color: #224d6f; font-weight: bold; display: block; width: 93px; padding: 0; } #nav li.on a { color: #f90; } #nav li.on ul a, #nav li.off ul a { border: 0; float: left; /*ie doesn't inherit the float*/ color: #f90; width: auto; margin-right: 15px; } #nav li.on:hover ul a, #nav li.over ul li a { /*for ie - the specificity is necessary*/ background: #224d6f; } #nav li.on ul { display: block; } #nav li.off:hover ul, #nav li.over ul { display: block; z-index: 6000; } #nav li.off a:hover, #nav li.on a:hover { color: #f90; } /*do the image replacement*/ #nav li span { position: absolute; left: -9384px; } #liRenaissance a, #liArtNouveau a, #liModern a, #liPostModern a, #liDigital a { display: block; position: relative; height: 26px; background: url(../images/bk-dropdownMap.gif) no-repeat; /*contains all hover states*/ } /*first, put the initial states in place*/ #liRenaissance a { background-position: 0 0; } #liArtNouveau a { background-position: -102px 0; } #liModern a { background-position: -204px 0; } #liPostModern a { background-position: -306px 0; } #liDigital a { background-position: -408px 0; } /*active area - for this demo - the code could be based on a body class, and probably work better.*/ #liModern.on a { background-position: -204px -37px; } /*add selectors for the other li's and background-positions*/ /*hover states*/ #liRenaissance a:hover, #liRenaissance:hover a, #liRenaissance.over a { background-position: 0 -73px; } #liArtNouveau a:hover, #liArtNouveau:hover a, #liArtNouveau.over a { background-position: -102px -73px; } #liModern a:hover, #liModern:hover a, #liModern.over a { background-position: -204px -73px; } #liPostModern a:hover, #liPostModern:hover a, #liPostModern.over a { background-position: -306px -73px; } #liDigital a:hover, #liDigital:hover a, #liDigital.over a { background-position: -408px -73px; } /*subnav formatting*/ #nav li.off ul a, #nav li.on ul a { display: block; background: #224d6f; color: #fff; font-family: arial, verdana, sans-serif; font-size: small; } #nav li.on ul a { background: #f90; } Hey guys, I am brand new to these forums, this seems like a good place to ask for help. So I am a novice web designer, I use AdobE Dreamweaver CS3. I have designed and coded some websites quite successfully, but now I keep running to the same problem. I have made my layout and turned it into different divs on Dreamweaver. This is in a very basic early stage. Next I want to add content, and I know how to do that, but every time I have done that and I add more content downward outside of the original "content" div's borders, the whole layout sometimes gets screwed up. Here is the address to the basic website that only looks to be alright: vivanidesign.com/newvivani/design.html. Then as I add content, to this particular page, it overflows, as shown in this website: vivanidesign.com/newvivani/designfail.html. How can I fix this? How can I make the background content image follow the text, so it will move down with it? Not just the content div, but the sidebar div also. Any help would be really great, I've tried to find out the answer to this for a while! Thanks! I have this: all my css files in one subdomain, html.website.com all my iamges in another subdomain, images.website.com i link my stylesheet: <link href="http://html.website.com/html/style.css" rel="stylesheet" type="text/css" /> and in the CSS: background:#333 url("../images/bodybg.png") repeat-x fixed top center; does not work. i have to put the whole domain in there? as far as relative paths, since the image is relative from the path of the location of the stylesheet? so I would think ../images/ should work? how do you set the width with CSS? i'd like to have a table with two columns, 70% and 30% with text-align left on the 70%, and text-align right on the 30%. any ideas? thanks. Argh - I am not very good with CSS (uhm, obviously) and all I am trying to do is change the color of some list items in a blog menu. It's Wordpress, and, it's not as if the blog is important - but this is driving me insane. I've installed Firebug in an effort to figure out what is making these items red - or #333. I can alter the code in Firebug and it gives a visual representation of what the edit would look like. But when I actually make the edit, nothing happens. And I've deleted my browsing history, used every browser, etc. - and I can change everything else! I am trying to change the text color in the right hand menu from red to, well, something else. The pages is at: http://www.webputzer.com The .css file looks like this: Code: /* Theme Name: alibi Theme URI: http://www.blogchemistry.com/ Description: 2 column, with RHS widget sidebar Version: 1.2 Author: BlogChemistry Author URI: http://www.blogchemistry.com/ */ body { margin: 0; padding: 0; color: #333; text-align:center; font-family:Arial, Verdana, Helvetica, sans-serif; font-size: 100.1%; background: #fff; } #wrapper2{ border-left: 1px solid #fff; border-right: 1px solid #fff; } #wrapper3{ border-left: 1px solid #666; border-right: 1px solid #666; } #wrapper4{ } #wrapper{ width: 770px; margin: 0px auto; padding: 0px; text-align:left; font-size: 85%; line-height:20px; background: #fff; border-left: 3px solid #333; border-right: 3px solid #333; } #header{ padding: 1px 0px; margin: 0; background: #ccc; } #header-inner{ margin:0; padding:0; } #content{ clear:both; margin: 0; padding: 5px 5px 5px 10px; background:#fff; } #content-inner{ } #main { width: 550px; float:left; margin: 0; padding: 5px 0 10px 0; overflow:hidden; } #sidebar { padding: 0; margin: 0 0 0 560px; background: #fff; } #footer { clear: both; margin: 0; padding: 10px 16px; text-align: center; font-size: 85%; } #footer-inner{ background: #f2f2f2; height: 50px; } #footer p{ margin:0; padding:15px 0; } #navigation{ padding: 5px 15px; } #navigation div.fleft{ float:left; } #navigation div.fright{ float:right; } #credit{ text-align:right; padding: 0 15px; } #credit p{ margin:0; color:#777; font-size:85%; } #credit p a, #credit p a:hover{ color:#999; font-weight:100; } /* ********** default styles *********** */ p, h1, h2, h3, h4, h5, h6{ margin: 10px 0; padding: 0; } h1, h2, h3, h4, h5, h6 { font-family: georgia, 'Times New Roman', sans-serif; } h1{ font-size: 190%; } h2{ font-size: 160%; } h3{ font-size: 120%; } h4{ font-size: 130%; } h5{ font-size: 100%; } h6{ font-size: 70%; } a{ color:red; font-weight:800; text-decoration:none; } a:hover{ color:red; text-decoration:underline; } a img{ border:0px; } hr{ height:2px; margin:5px 0; border-bottom: 1px solid #ccc; border-top: 1px solid #ccc; } blockquote{ background: #f4f4f4; padding: 5px 15px; margin: 3px 30px; } form{ margin: 0; padding:0; } fieldset{ padding:10px; margin:0; border:none; } legend{ font-weight:800; } code{ font-size: 90%; font-family: "Courier New", Courier, monospace; white-space: pre; } td{ vertical-align:top; } #tabs { float:left; width:100%; font-size:90%; background:#000; line-height:18px; border-top: 1px solid white; } #tabs ul { margin:0; padding:4px 10px 0 10px; list-style:none; } #tabs li { display:inline; margin:0; padding:0; } #tabs a { float:left; margin:0; padding:0 0 0 4px; text-decoration:none; } #tabs a span { float:left; display:block; padding:5px 15px 3px 6px; color:#FFF; } /* Commented Backslash Hack hides rule from IE5-Mac \*/ #tabs a span {float:none;} /* End IE5-Mac hack */ #tabs a:hover span { color:#FFF; } #tabs a:hover { background-position:0% -42px; } #tabs a:hover span { background-position:100% -42px; } /* Headings */ form#searchform2{ display: block; float:right; margin: 55px 10px 0px 5px; } #header h3{ margin: 0; padding: 30px 0 0 10px; } #header h3 a{ font-weight:100; color: #fff; text-decoration: none; font-size: 220%; letter-spacing: 1px; } #header h2{ margin: 0; padding: 10px 0 5px 10px; font-weight:100; font-style:italic; color: #fff; font-size: 130%; letter-spacing: 1px; } h2#sectiontitle{ font-size:100%; font-weight: 800; font-family: arial, verdana, sans-serif; padding:6px 6px 6px 10px; margin:8px 10px 5px 10px; background: #f2f2f2; color: #444; } /* post styles */ .post{ margin: 0 0 10px 0; padding: 0 5px 5px 5px; } .entry{ margin: 0; padding: 0px 10px 3px 10px; } .post h2 { color: #333; font-size: 150%; font-weight:100; padding: 7px 0 2px 2px; margin: 10px 0 15px 0; } .post h2 a{ color: #333; text-decoration:none; font-weight:100; } .post h2 a:hover{ text-decoration:none; color: #333; } .postmetadata{ font-size:80%; padding: 1px 8px 1px 5px; margin: 0; border-top: 1px solid #ccc; } .postmetadata p{ line-height: 18px; padding: 0; margin: 2px 0; } .date{ float:left; text-align:center; font-weight:800; margin: 0 10px 0 0; padding: 0 10px; border-right: 1px solid #ccc; color: #444; } .dateDay{ display:block; font-size: 16px; line-height: 16px; text-align:center; } .dateMonth, .dateYear{ display:block; font-size: 11px; padding:0; line-height: 12px; } /* Comments */ h3#comments, h3#postcomment{ font-size: 100%; font-family:verdana, sans-serif; } ol#commentlist{ padding: 0 0 0 20px; font-size: 90%; list-style-type: none; } ol#commentlist li{ padding: 0px 3px; margin: 0; } ol#commentlist li p.commentheader{ margin: 0px 0 0px 0; display: block; padding: 1px 5px; } ul#commentlist{ padding: 0; margin:0; list-style-type:none; } ul#commentlist li{ display: block; padding: 0; margin: 0 15px 5px 15px; font-size:90%; background: #f2f2f2; } ul#commentlist p{ margin: 6px 0; } ul#commentlist li div.comm{ margin: 1px; padding: 1px; } ul#commentlist li div.gravatar { width:50px; float:left; padding: 10px 0 0 10px; } ul#commentlist li div.gravatar img{ border: 2px solid #ccc; } ul#commentlist li div.commenttext{ padding: 0; margin:5px 10px 5px 65px; } ul#commentlist li div.commenttext div.commentwrapper{ margin:0 0 0 5px; padding: 3px 8px; } /* sidebar styles */ #subscribe p{ font-size: 85%; margin: 3px 0 10px 0; } .menu{ padding:0; font-size:90%; } .menu a{ font-weight: 100; } .menu a:hover{ text-decoration:none; } .menu ul{ margin:0; padding:0; list-style-type:none; } .menu ul li.widget{ padding:2px; margin:0 0 0px 0px; } .menu ul li.widget ul{ margin: 0; padding:0; } .menu ul li.widget ul li{ border-bottom:1px dotted #ccc; background: #f2f2f2; padding: 2px 0 2px 15px; margin:0; } .menu ul li.widget ul li ul{ } .menu ul li.widget ul li ul li{ border-top: 1px dotted #ccc; border-bottom: none !important; padding: 2px 0 2px 15px; } .menu ul li.widget h3{ font-family: arial; font-size:120%; padding:2px 0 1px 4px; margin:0; border-top: 3px solid red; border-bottom: 1px solid #bbb; color: #333; font-weight: 800; font-variant:small-caps; } .menu ul li h3 a{ color: #333; font-weight: 800; } .menu ul li h3 a:hover{ color: #333; text-decoration: none; } .menu form{ display:block; margin:0px; padding:4px; } .menu input{ margin:3px 0; font-size:90%; } li.widget .textwidget, li.widget #search { padding: 2px 5px; } /* Calendar styles */ #wp-calendar { empty-cells: show; margin: 10px auto 0; width: 155px; } #wp-calendar #next a { padding-right: 10px; text-align: right; } #wp-calendar #prev a { padding-left: 10px; text-align: left; } #wp-calendar a { display: block; } #wp-calendar caption { text-align: center; width: 100%; } #wp-calendar td { padding: 3px 0; text-align: center; } #footer a{ font-weight: 100; } If anyone could tell me what the heck is making this uneditable - man...I'd sure like to know... I am trying to figure out the best way to right justify an element in relation to other elements within a div. Here is an example: <head> <title>right position</title> <style type="text/css"> #maindiv {width: 600px; background: #cccccc; padding: 10px; border: solid 1px black;} .left {font-size: 2em;} .right {padding-left: 350px} </style> </head> <body> <div id="maindiv"> <span class="left">hello world</span> <span class="right">hi there</span> </div> </body> This can't be the best way to right position something, can it? The only alternatives I can think of are absolute positioning or possibly floating, which seems unnecessarily complicated for something so simple. Can anyone suggest a better way of doing this? Ideally, the element would stay pinned to the right even if the left element changes widths. Thanks in advance, CSS Newbie! I am trying to create a page to be printed out as a letter but I cannot for the life of me make the footers stick to the bottom when printed. Here is the code: Code: <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Header Test</title> <style type="text/css"> body { font-family:arial; font-size:10pt; } h1 { text-align:center; margin:0; padding:0; } div.letter { page-break-after:always; } .from { text-align:center; } .to { font-style:normal; margin-top:30px; } .date { } .footer { position:absolute; bottom:0; } </style> <!-- compliance patch for microsoft browsers --> <!--[if lt IE 7]> <script src="/ie7/ie7-standard-p.js" type="text/javascript"></script> <![endif]--> </head> <body> <div class="letter"> <h1>Stanley Road Baptist Church</h1> <address class="from"> Stanley Road, Morecambe, Lancashire, LA3 1UP </address> <address class="to"> Joe Bloggs </address> <p class="date"> Friday 27th August 2004 </p> <p> Dear Joe,<br /> Blah blah blah. </p> <p> Yours sincerely, </p> <p> Matt Fletcher </p> <div class="footer"> The Footer In Question </div> </div> <div class="letter"> ... </div> <div class="letter"> ... </div> </body> </html> I can get it to stick to the bottom of only the first page, but it doesn't appear on any others. So I have a body div which has a left and right div(columns). I need to add 2 more divs inside the left div. But, these 2 divs have to unordered lists in them. I know my CSS is pretty average if not worse. My layout looks fine except for when I add 2 divs.. I have the float:left with %50 widths.. Screen shot of how my layout looks. img209.imageshack.us/img209/2913/idear.gif I did not add any clear tags to my css.. which I think might be what's causing the issue. Side note: In IE compatibility view the top of the page has a gap and so does the right of the page.. the logo and footer are both 100% width and the top div has a -negative margin to close the gap, it looks fine without compatibility view, and fine in firefox, and chrome. XHTML passed validation and so did CSS. This is before even messing with the columns. I didn't do anything with the unordered lists. Maybe i should ask how to correctly make my layout first.. Because what I've been doing is just adding new divs where I see fit, and then going back to edit the CSS till it works. Thanks for helping me out! BTW: what book would you recommend me getting.. I understand basics of CSS and I think I'm good with XHTML, I just need to get a better definition of CSS than w3schools has to offer. Thanks again. I have floating items inside of floating items. The problem is I cannot clear my floating items in the middle column because that ruins the other columns. How can I clear floats in the middle column? Do you have any better ideas to make my layout work? I have attached in image of how the layout should work. 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> <title>Title</title> <style type="text/css"> #content { display: block; margin: 0 5px; padding: 0 10px; border-top: 1px solid #0B4867; } .content100 { width: 100%; padding: 0px; margin: 0 .5% 0 .25%; display: inline; background: #ffeeee; } .content50 { width: 48.75%; display: block; float: left; margin: 0 .5% 0 .25%; padding: 0px; background: #eeffee; } .content33 { width: 32.25%; display: block; float: left; margin: 0 .5% 0 .25%; padding: 0px; background: #eeeeff; } </style> </head> <body> <div id="content"> <div style="margin: 0px 215px; padding: 0px; border: 0px; display: block;"> <div class="content100"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vivamus viverra malesuada turpis. Sed iaculis justo sed turpis. Nulla malesuada turpis sed nibh. Mauris dui quam, cursus at, sollicitudin a, auctor quis, ligula. Vivamus varius blandit velit. Sed eu nibh. Vestibulum sit amet massa. Maecenas elementum massa ac ligula. In vitae massa ut dui facilisis lacinia. Maecenas tristique pede in elit. Duis ultricies aliquam metus. Mauris neque. Nunc nec lectus eu metus rhoncus imperdiet. Etiam egestas semper nunc. Nunc pretium tincidunt felis. </div> <div class="content50"> <h2>Row 1, Column 1</h2> In nec est pretium elit eleifend semper. Suspendisse potenti. Nunc bibendum sollicitudin ante. Aliquam facilisis mi quis turpis. Nullam aliquet. Sed eget urna in metus mattis luctus. Sed nunc. Maecenas est. Morbi ullamcorper eros non magna. Donec auctor, orci pretium rutrum eleifend, pede arcu pretium dui, vitae vestibulum ante odio sit amet dui. Aliquam fringilla velit sit amet magna. Proin cursus, elit quis faucibus fermentum, diam tellus rhoncus nulla, ut iaculis orci velit id metus. Pellentesque diam metus, dapibus eu, vestibulum quis, elementum id, turpis. Morbi elementum, quam non rhoncus hendrerit, metus lacus bibendum ante, vitae sodales velit est eu neque. </div> <div class="content50"> <h2>Row 1, Column 2</h2> This column is not very high. </div> <div class="content100"> Donec sed velit mollis erat consequat ornare. Donec accumsan, sapien a posuere tristique, felis turpis tristique odio, nec accumsan velit ipsum eu tellus. Duis vel felis. Maecenas in arcu nec nisi cursus consectetuer. Ut ac felis. Mauris aliquet lectus quis nisl. Aliquam quis urna quis diam facilisis imperdiet. Curabitur sit amet eros. Curabitur purus. In arcu magna, bibendum varius, elementum non, cursus eget, nulla. Etiam vulputate velit. Sed interdum leo in ligula. Sed non justo id odio bibendum tincidunt. Sed dictum, ipsum eget blandit luctus, nisi felis rhoncus nisl, sodales imperdiet neque quam id mauris. </div> <div class="content33"> <h2>Row 2 Column 1</h2> Felis turpis tristique odio, nec accumsan velit ipsum eu tellus. Duis vel felis. Maecenas in arcu nec nisi cursus consectetuer. Ut ac felis. Mauris aliquet lectus quis nisl. Aliquam quis urna quis diam facilisis imperdiet. Curabitur sit amet eros. Curabitur purus. In arcu magna, bibendum varius, elementum non, cursus eget, nulla. Etiam vulputate velit. Sed interdum leo in ligula. Sed non justo id odio bibendum tincidunt. Sed dictum, ipsum eget blandit luctus, nisi felis rhoncus nisl, sodales imperdiet neque quam id mauris. </div> <div class="content33"> <h2>Row 2 Column 2</h2> This column is not as high as the previous one. </div> <div class="content33"> <h2>Row 2 Column 3</h2> </div> <div class="content100"> Nunc vel arcu. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam luctus tellus luctus magna. Aenean tellus sapien, venenatis id, hendrerit sit amet, lacinia sed, ante. Nullam metus. Sed cursus lobortis orci. Etiam suscipit, tellus ut rutrum mollis, urna libero ultrices lectus, non hendrerit quam elit id leo. Quisque sollicitudin, mi id imperdiet sollicitudin, orci enim rutrum nibh, non adipiscing diam augue commodo nunc. Maecenas erat massa, sagittis eu, sagittis at, commodo nec, dolor. Aliquam erat volutpat. Donec nisl erat, vulputate id, dictum non, vulputate egestas, sapien. Fusce non justo eu felis imperdiet placerat. Suspendisse mattis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ac tellus eget risus varius vehicula. In ante. </div> </div> </div> </body> </html> I've got limited experience with CSS and I've never done anything with divs, only tables. So my question is really, really, really basic: Not being as adept at CSS as I could be, especially positioning, I'm sort of at a loss as to how to best structure my page using divs. Looking at the comp at http://homework.describe.org/esdcar_home.jpg, would it be best to make everything from the top to the start of the brown bar at the bottom and from the left to the start of the picture one "column" (with nested divs), with everything to the right of the picture's edge a second "main content" column with nested divs inside it? Or should I make one header div that runs from left to right until either above or below the navigation (?), and everything below that point be a 2-column layout (until the brown bar at the bottom)? Does it matter one way or the other? Will it one day be clear to me immediately exactly how best to divide up and structure a page from a comp? Am I just a confused soul, or does everyone kind of struggle with this at the beginning? Sorry to ask such basic questions, but... Thanks in advance. T. |