CSS - Need Help Building Layout
Hi everybody,
I'm trying to build a layout. There is one piece in the center, a company logo and address. Things are supposed to branch off of it, and you click on them you know, and then that makes it work. I got the thing centered very nicely using absolute positioning and negative margins, but I'm having trouble adding in the little branches. How do you do that without them overlapping the centered thing and moving all around based on resolution? Can it be done? I'm thinking about doing it with an imagemap or Flash instead, but I'd prefer just square CSS. We want the centered thing to recenter itself based on the resolution, and we'd like these things to always be so far from there, but I don't know how to do that. Doesn't work with absolute positioning and I'm not sure if it does with relative (I've not been able to get it to). I made a little drawing of what it should look like. Please see http://tinypic.com/55nsl0 . Thank you, your assistance is deeply appreciated. Similar TutorialsI am trying to build a menu that will load content either on the right of it or the left. I have looked for a tutorial on how to do this but am having no luck with the search engines. Here is a picture of what I would like to do. If anyone can assist me with this it would be very helpful. Or maybe even point me in the direction of a source. Thank you! I'm trying to build a window script. To start with I'm just trying to finalize the HTML needed for the window. You'll find my attempt below. The first one is before adding close and resize elements. It seems an ok starting point. The 2nd one shows my attempt to add the close & resize elements. The difficulty is in making them line up with the right hand side of the window and making the top one not take up an extra line. The problem is that I don't want to specify the size of the 'window' div because I want it to expand to fit the content. Because there is no width set any attempt to align right ends up aligning with the right hand side of the browser window. Anyone got some ideas as to how I deal with this? Am I approaching it wrong? Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>New Document</title> <style type="text/css"> html, body { margin: 0px; } .window { background: gray; position: absolute; border: 1px solid black; top: 20px; left: 20px; } .ex2 { left: 300px; } .topBar { position: relative; color: white; margin: 2px; } .ex2 .topBar { background: none; } .closeButton { width: 16px; height: 16px; background: red; } .window .content { width: 200px; height: 200px; background: white; overflow: auto; } .bottomBar { position: relative; } .ex2 .bottomBar { background: none; } .resizeHandle { background-color: green; height: 16px; width: 20px; } </style> </head> <body> <div class='window'> <div class='topBar'> Title </div> <div class='content'> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> </div> <div class='bottomBar'> </div> </div> <div class='window ex2'> <div class='topBar'> Title <div class='closeButton'> </div> </div> <div class='content'> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> Content goes here<br> </div> <div class='bottomBar'><div class='resizeHandle'> </div></div> </div> </body> </html> I am trying to build a table in which the center scrolls both ways but the columns and rows around the edges stay put - have a look at the page below using IE6 to see what I mean: (URL address blocked: See forum rules) This is working exactly as I want it to in IE6, my problem is that I can't get it to work right in IE7 - the horizontal scrolling is not working properly. By re-instating the commented out code on line 81 I can get it to sort of work, but I don't want to have to specify the width like this as the table contents are going to be dynamic and there is no way of knowing how wide they will be. This is for use on a company intranet where all the users have IE6 or IE7, hence I am not concerned with other browsers or earlier versions of IE. Any help getting this working would be much appreciated... P Should I or should I not learn more about coding when I build my page using Dreamweaver anyways and it looks and functions fine. I am stuck wit the issue of doc types in my pages which has prevented me to make a center middle design page and had to remove the doc type code on all my websites so that the page content will end up at centre middle. The only solution I have been offered was to use CSS but I have so many old sites that converting the sites I have built to CSS would be too time consuming and not worth it. Anyone have any other better ideas? Hello, I am using an OS Commerce layout for a client's website. On this page - www.mts-diesel.com you will see how I have the homepage laid out in anticipation of design, with 3 divs of varying colors. One div with an id of #hp_left is where I want to put a nice jquery code. But when I insert that into #hp_left it breaks the whole layout, was seen here www.mts-diesel.com/index2.php I'm not sure what in the css in the code for this script is breaking my layout but Ithought someone here might be willing to shed some light. A big thank you. Tom I am working on the new home page which is based on a template. The left sideColumn is working fine, however I am having a few problems with the mainColumn layout. Here is a static image to show what I want it to look like Here are the problems I am having: 1) The #scroll box is place where I want it in IE but in foxfire it is right up against the left side of the #sideColumn partially hidden. There will be text that scrolls into this box and stops. I haven't started on the part yet - in case that makes a difference. Not my choice, but that is what the bosses want. 2) I want the image centered horizontal within the #mainColumn. Here is what I have for the css: #home img { margin: 5px auto 5px auto; } which I thought would do the trick, but it's not. 3) I want the p text to have a 40px margin on the right and left side like the .large does. Here is what I have for the css: #home p, .large { margin: auto 40px auto 40px; } It works for the .large (Welcome to Vitalograph), but not for the text below it. At one point I had it working, but after addtional changes fixing other problems, now it doesn't and I can't figure out why. Here is the xhtml starting at the 2 column part (wrapper): Code: <!--begin wrapper--> <div id="wrapper"> <!--begin side column --> <div id="sideColumn"> <span class="category">Products</span> <ul> <li><a href="/products/spirometers.html">Spirometers</a></li> <li><a href="/products/clinical_trials.html">Clinical Trials</a></li> <li><a href="/products/asthma_copd.html">Asthma & COPD</a></li> <li><a href="/products/smoking_cessation.html">Smoking Cessation</a></li> <li><a href="/products/resuscitaion.html">Resuscitation</a></li> </ul> <span class="category">Resources</span> <ul> <li><a href="/resources/contact_us.html">Customer Support</a></li> <li><a href="/resources/training_services.html">Training & Services</a></li> <li><a href="/resources/exhibitions.html">Exhibitions</a></li> <li><a href="/resources/newsletters.html">Newsletters</a></li> <li><a href="/resources/downloads.html">Downloads</a></li> <li><a href="/resources/useful_links.html">Useful Links</a></li> <li><a href="/resources/industry_information.html">Industry Information</a></li> <li><a href="/resources/industry_information.html">Sitemap</a></li> </ul> </div> <!--end of side column --> <!--begin main column --> <div id="mainColumn"> <!-- InstanceBeginEditable name="Main_Section" --> <div id="home"> <div id="scroll"><span>scrolling news will go hear and stop</span></div> <img src="/images/boys_bubbles.gif" width="485" height="333" alt="boys and bubbles" /> <span class="large">Welcome to Vitalograph</span> <p>Vitalgraph offers a wide range of spirometers along with other asthma management equipment with over 40 years experience. From simple hand-held units to sophisticated Windows based spirometry systems, we have it all. Check out our full line of respiratory equipment under the product category.</p> <p><a href="/about_us/about_us.html">more about us...</a></p> </div> <!-- InstanceEndEditable --> </div> <!--end of main column --> </div> <!--end of wrapper--> Here is the vitalograph_master.css: Code: body { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff; color: #515151; margin:0px; padding:10px; } /*page container settings*/ #page { width: 750px; height: 600px; border: 1px solid #5094F9; background-color: #FFFFFF; overflow: hidden; margin: auto; padding: 10px 10px 10px 10px; text-align: left; } /*logo header and tag settings*/ #header { margin: 0; padding-bottom: 5px; width: 450px; height: 36px; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; color: #5094F9; text-align: left; } #header img { vertical-align: -7px; } .tagline { color: #5094F9; font-size: 16; font-style: italic; font-weight: bold; display: inline; clear: both; line-height: 20px; margin-left: 10px; } /*top bar settings*/ #topbar { float: top; height: 20px; background-color: #5094f9; clear: both; padding-left: 10px; text-align: left; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; color: #FFFFFF; font-size: 12px; font-weight: bold; } #topbar a:link, #topbar a:visited { background-color: inherit; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; text-decoration: none; color: #FFFFFF; font-size: 12px; font-weight: bold; } #topbar a:hover, #topbar a:active { background-color: #FFFFFF; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; text-decoration: none; color: #5094F9; font-size: 12px; font-weight: bold; } #topbar ul { list-style: none; margin: 0; padding-top: 2px; } #topbar li { display: inline; margin-right: 160px; } /*Main Section two columns under top section*/ #wrapper{ padding: 10px 10px 10px 0px; width: 100%; height: 100%; } #sideColumn { float:left; width:155px; height: 78%; background-color: #5094F9; padding-top: 50px; padding-left:10px; padding-bottom:10px; pading-right: 10px; margin-right: 10px; text-align: left; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; color: #FFFFFF; font-weight: bold; line-height: 20px; } .category { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; color: #FFFFFF; font-size: 16px; font-weight: bold; letter-spacing: 5px; } #sideColumn a:link, #sideColumn a:visited { background-color: inherit; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; text-decoration: none; color: #FFFFFF; font-size: 12px; font-weight: bold; } #sideColumn a:hover, #sideColumn a:active { background-color: #FFFFFF; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; text-decoration: none; color: #5094F9; font-size: 12px; font-weight: bold; } #sideColumn ul { list-style: none; padding: 15px 0px 15px 10px; margin: 0px; } #mainColumn { padding: 0px; } /*footer*/ .footer { font-family: "Times New Roman", Times, serif; font-size: 9px; color: #999999; } /*text*/ .large { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; color: #5094F9; font-size: 18px; font-weight: bold; margin-bottom: 15px; } Here is the home.css: Code: /*home page*/ #home { margin: auto; } #home img { margin: 5px auto 5px auto; } #home p, .large { margin: auto 40px auto 40px; } #home a:link, #home a:visited { background-color: inherit; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; text-decoration: none; color: #5094F9; font-size: 12px; font-weight: bold; } #home a:hover, #home a:active { background-color: inherit; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; text-decoration: none; color: #990099; font-size: 12px; font-weight: bold; } #scroll { width: 560px; padding: 5px; background-color: inherit; border: 1px solid #5094F9; margin-bottom: 5px; } Any help or suggestions are greatly appreciated. Hi there and thanks for reading & helping! I am new to this site, but here is my question: I need to build about a 20 page website. I have been told I should do the "layout" for each page using CSS. Is it possible for each page to "link" to one CSS file for layout instructions? I have found suitable CSS layout templates but am unsure how to link each page to the external CSS file for a basic "header, 2 column, footer" layout, or if it is even possible? I've been scouring the net and the two books I have (Eric Meyer on CSS and CSS By Example), but I can't seem to wrap my head around the proper way to do a complex layout with <div>s. Here is what I want in English: 1. A masthead/titlebar - always takes up the full browser width, with an image fixed on the left, say 100 px high, at the top of the page. 2. Left and right sidepanes, say 100 px wide, starting under the masthead, that are as long as 3. The middle section for content. This is the main area, and it may be arbitrarily long. This area determines the height of the entire page such that the sidepanes extend all the way to the bottom. I would love to have (1) and (2) occur before (3) in the flow, so that I can make a simple header file for the masthead/sidepanes, then include the content, then close everything off with a footer file. Here is my horribly borked attempt at using nested <div>s: Code: <html><head><title>CSS Hell</title> <style TYPE="text/css"> <!-- body { margin: 9px; margin-bot: 0px; background: #FFF; } #level0 { background: white; } #masthead { background: blue; height: 60px; } #level1 { background: #DDD; border: solid; } #menu { background: #BBB; width: 150px; } #level2 { background: white; float: right; border: dashed; } #promo { background: blue; float: right; } #main { background: #CCC; } --> </style> </head> <body> <div id=level0> level 0 <div id=masthead> branding </div> <div id=level1> <div id=menu> LEFT SIDEPANE<br> menu<br> menu<br> menu<br> menu<br> menu<br> menu<br> menu<br> </div> level 1 <div id=level2> level 2 <div id=main> main content area<br> main content area<br> main content area<br> main content area<br> main content area<br> main content area<br> main content area<br> main content area<br> main content area<br> main content area<br> main content area<br> main content area<br> main content area<br> </div> <div id=promo> RIGHT SIDEPANE<br> promo<br> promo<br> promo<br> promo<br> promo<br> promo<br> promo<br> promo<br> promo<br> promo<br> </div> </div> </div> </div> </body> </html> Level 2 is nested inside level 1, but Firefox .9 renders the level2 div underneath level1. Also, the bottom border for level1 doesn't show up. ?!!?!? I'm trying to figure out if the following layout is possible using css such that it will appear correctly in all "major" browsers: lab.wx3.com/cssprob/layout_challenge.png (sorry, I'm a new user so I can't post the http part) The center column should be fixed width, 100% of browser in height. Values marked as "fixed" would have a defined pixel size. Values marked as "fluid" would fill available space. I know this layout can be done with tables, but I'm at a loss to figure out how it can be done in css. So I'm trying to get a semi-liquid layout that has the side benefit of allowing the HTML page content to be organized in a way that losing the stylesheet won't kill it. Ideally, the HTML page would be: LOGO BREADCRUMBS CONTENT MENU RIGHTSIDE CONTENT FOOTER Unfortunately, I've had to move the rightside content up in the page order since I can't seem to configure my CSS in a way that makes it work the other way. This is as far as I've gotten, and I can't get the footer to properly begin at the end of the longest element. I know it's a side effect of the absolute positioning of the Logo and Menu, but I can't think of a way to layer this stuff any better. Help! If you can help me get this up and running, I'll be sure to thank you and hit you back with a link on my site when it's done. Since I can't link directly to anything yet, here's the image of what the layout should look like. I want the footer to fall under the scroll bar if there is one, I don't want a ever-present footer. Code: www.ctechsinc.com/temp3/mockupb.gif Code: * { padding-left: 0px; margin:0px; } table { border-collapse:collapse; } img { border:none; } #container { width:100%; } .logo { float: left; height: 260px; width: 200px; background-color: #0099CC; } .menu { background-color: #996699; width: 200px; height: 150px; float: left; position: absolute; top: 260px; left: 0px; } .greenwrap { background-color: #006633; margin-left: 230px; margin-top: 10px; /* this can be deleted once implemented; it's only here to help align things */ } .breadcrumb { background-color: #99CCCC; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } .content { min-width:220px; height:100px; background-color: #00CCCC; float: left; } .contentwrap { background-color: #00FF99; float: left; } .sidebar { width: 200px; background-color: #3399FF; float: none; right: 0px; position: absolute; } .box1 { background-color: #00FFFF; min-width:220px; margin-top: 20px; margin-right: 220px; margin-bottom: 20px; margin-left: 20px; } .qlink { margin: 20px; } .footer { margin:0px; width: 100%; float: left; clear: none; } Code: <html> <head> <link href="screen2.css" rel="stylesheet" type="text/css"> </head> <body> <div> <div class="logo"> Logo </div> </div> <!-- content, RH --> <div> <div class="greenwrap"> <div class="breadcrumb"> <h1>BREADCRUMBS</h1><br> </div> <!-- <div class="content"> --> <div class="contentwrap"> <div class="box1"> <h2>heading!</h2> <p>Lorem Ipsum buttsecks. Lorem Ipsum buttsecks. Lorem Ipsum buttsecks. Lorem Ipsum buttsecks. Lorem Ipsum buttsecks. Lorem Ipsum buttsecks. Lorem Ipsum buttsecks. Lorem Ipsum buttsecks. Lorem Ipsum buttsecks. Lorem Ipsum buttsecks. </p> </div> <div class="box1"> <h2>heading!</h2> <p>Lorem Ipsum buttsecks. Lorem Ipsum buttsecks. Lorem Ipsum buttsecks. Lorem Ipsum buttsecks. Lorem Ipsum buttsecks. Lorem Ipsum buttsecks. Lorem Ipsum buttsecks. Lorem Ipsum buttsecks. Lorem Ipsum buttsecks. Lorem Ipsum buttsecks. </p> </div> </div> <div class="sidebar"> <div class="qlink"> <p>boring content boring contentboring content boring contentboring content boring contentboring content boring contentboring content boring content </p> </div> </div> <!-- </div> --> </div> <div class="menu"> <p>Menu</p><p>Menu</p><p>Menu</p> </div> <div class="footer"> <p>Fooooooooooooooooooooooooooooooooooooooterrrrr!</p> </div> </div> <!-- menu --> </body> </html> I'm working on converting a website from tables to div's and running into one little issue. The site is a basic header on top, navigation on left, content on right and a footer on the bottom. I would like the navigation div to grow in height to match the height of the content div so that the background fills the left side of the page. I have placed the nav and content divs in a container div and set a min-height on the container. I was hoping that that would let me place height: 100% on the navigation div but it isn't growing ever. Is there a way to get something like this done? FYI, the site is currently at http://users.adelphia.net/~mmorasch/ The site I'm working on is located at the following address: http://www.solinari.net/div.php On the left, the navigation is in two pieces - a left and a right piece. I need to have both pieces extend to the bottom of however long the page is. The bottom div's of both pieces of the navigation each have an image repeating vertically, my question is how to get the div to extend to the bottom of the page. Any help would be greatly appreciated. Regards, Solinari Attached is my html page and my css file. The css is a template i got off ssi-developer. I'm changing it around a bit to fit my needs. The way I have the page now is fine I'm just curious to know if I can do this one thing. What I'm wondering is if I have to make different classes for the multiple rows that I have. Is there a way I can make the same layout without making all the rows. Once you see my files you will get a better understading of what I'm trying to accomplish. The page is http://cannons.dsl.xmission.com/index.html I am having problems making the footer go to the bottom what do I need to change to make it work? Thanks Need help with layout, picture attached. I need the footer's end to be at the level of the sidebars end unless content is too long and in that case it would expand in height. In other words there has to be a min height for content so footer wont go any higher than in the picture, but will go down if content expands. Any tips on how this needs to be done? I'm using a similar template to the one located he http://www.linux.co.uk In Internet Explorer you'll notice a space to the right of the "sponsored links" text in the right hand portlets area. Also a space at the bottom of this same porlet on the left hand side. It seems to be aggravated at different font sizes. These spaces don't show up on Mozilla, it works perfectly. Any ideas for fixing this behaviour? Thanks.. -j. Hello, I am creating the base design of a web site that consists in two horizontal bars: Navigation and Intro. "Navigation" will contain the menu. "Intro" will contain two items: a logo (image) on the left and a banner (flash) on the right. In this moment I have the following: http://www.27lamps.com/Beta/Bar/Bar.html I am not sure if using a background image is the best way to do this ... ... it seems to me that since the two bars are two different sections then I should use two divs. So the questions I have: 1. Should I use two divs, one for each bar, and setting the line- height in em instead of using the background image? 2. How to place side by side the logo and the banner and centered them vertically? 3. I would like the Navigation and the Intro bars to have a minimum height. Thanks, Miguel I'm doing a layout with div's and I want to have my navigation a pixel size, but my content area a percentage. (and have them beside each other) Here's what I've tried, but the 'main' div goes 100% of the window instead of 100% of the space between the left side and the 'nav' div. Is what I'm trying to do possible with div's? HTML: <div id="main"> stuff </div> <div id="nav"> navigation </div> CSS: #main { float: left; width: 100%; background: #efe; } #nav { float: left; width: 200px; margin-left: 4px; background: #999; } My layout is pretty simple. 1 large columb in the center that should extend the full length of the browser(minimum) regardless of how much text is in it. 1 column on either side of it for other content. I cannot get the middle column to extend to 100%. it stops at the data. Here is my CSS. Code: body { margin: 0; padding: 0; font-size: 12px; font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Lucida, Geneva, Helvetica, Arial, sans-serif; background-color: #C10E0E; } #leftcolumn { display: inline; float: left; left: 15%; width: 150px; } #centercolumn { float: left; width: 511px; height: 100%; margin-left: 2px; padding: 8px; border-left: 1px solid #494949; border-right: 1px solid #494949; background: url(/images/bg.png) no-repeat top left; background-color: #FFDCAA; } #rightcolumn { float: left; width: 150px; margin-left: 1px; } #mainnav { width: 150px; padding: 0 0 0 0; font-size: 12px; font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Lucida, Geneva, Helvetica, Arial, sans-serif; background-color: #C10E0E; color: #FFDCAA; } #mainnav ul { list-style: none; margin: 0; padding: 0; border: none; } #mainnav li { margin: 0 0 0 0; border-left: 7px solid #C10E0E; padding: 0 5px 0 0; } #mainnav li a { display: block; height: 15px; vertical-align: middle; padding: 0 0 0 0; margin: 0 0 0 0; background-color: #C10E0E; color: #FFDCAA; text-decoration: none; text-align: right; } html>body #mainnav li a { width: auto; padding: 0; margin: 0; } #mainnav li a:hover { background-color: #C10E0E; border-left: 7px solid #FFDCAA; color: #FFF; padding: 0; margin: 0; } #mainnav h3 { padding-left: 5px; font-size: 14px; font-weight: bold; color: #F6D4A4; font-style: italic; } thanks! |