CSS - Help With Layouts In Css
Hi,
Am very new to CSS, and need some advice. Broadly speaking, how would I achieve this layout using purely CSS? Thanks in advance http://forums.devshed.com/attachmen...tachmentid=4990 Similar TutorialsWell, I know CSS however I am a bit confused with fixed width and liquid layouts as far as I know fixed width is where you set a divs width in pixels and liquid is in % so it scales to the users screen size? Which one is best to use? Also, I have the following style sheet which I created, I am guessing this is a liquid layout? Code: * { margin: 0; padding: 0; } body { font-size: 15px; background-color: black; color: white; } #header { width: 100%; margin-bottom: 10px; border-bottom: 1px solid white; } #header h1 { padding-left: 25px; margin-bottom: 0px; } #content { padding: 10px; margin-left: 200px; border-left: 1px solid white; } #content h1, h2, h3, h4, h5, h6 { text-align: center; } #nav { float: left; padding: 10px; padding-left: 15px; width: 20%; } #nav li { list-style-type: none; } #nav a { text-decoration: none; } #footer { clear: left; border-top: 1px solid white; margin-top: 10px; margin-bottom: 10px; border-bottom: 1px solid white; width: 100%; } a { color: silver; text-decoration: underline; } a:hover, a:focus { font-weight: bold; } a:visited { font-style: italic; } h1, h2, h3, h4, h5, h6 { margin: 10px; } p { margin: 5px; } select { width: 30%; } textarea { width: 40%; } .floatimage { float: left; margin: 10px; } This is driving me absolutely insane. The transition from table designs to css designs is a brutal one, in case no one is aware. Table designs seem so much easier, but I guess I might as well be compliant. Here's my problem: All I need to do is have a three column box that has a select box in the left column, then two images vertically aligned in the middle within the middle column, and a second select box in the right column. This would be incredibly easy with tables seeing that all I would need is: Code: <table> <tr> <td align="left"> <select> <option>Option</option> </select> </td> <td valign="middle" align="center"> <img src="picture1.jpg"/><br/> <img src="picture1.jpg"/> </td> <td align="left"> <select> <option>Option 2</option> </select> </td> </tr> </table> I'm assuming that since it's this easy to do with tables and everyone is opposed to using tables for design, there must be an easier way using divs and the like. Please enlighten me, someone! First off I am entirely new to using CSS for anything other than some link and scroll bar decorations. Secondly, this code does not (currently) validate but I think I can resolve those issues, but before I go to the trouble of appeasing a (forum) guideline and making sure the code validates I have some questions that may or may not prevent me from using the code or CSS all together. The code (template/stle sheet) I am using is from http://www.code-sucks.com/css%20layouts/css-3-column-layouts/ the top question I have now is: How can I seperate elements within the "header" section of this format? i.e. within the "header I would like to place a logo to the far left + a slogan and also place an advertising banner? normally I would do this with three or more table cells. would it compromise the benefit of switching from mainly table oriented pages to CSS by including "some" tables within the CSS sections? Thanks for any insights and sorry if I have crossed any lines with this query. I think it would answer a lot of questions if we make a list of cross browser css layouts. I am going to post all of my submissions via http://www.blendedcodes.com so everyone can see a live demo and change the code around live. Please post your submissions via blendedcodes.com or a similar site that lets visitors interact with the code. This is all about everyone learning the css layouts... I'll compile them all and post the final list when I close the thread. Centered body with left and right columns http://www.blendedcodes.com/DTrzZ6In Table made of floating divs http://www.blendedcodes.com/CFwtV3S1 I've been thinking about switching over to making table-less css layouts, but there's been a few things holding me back, as I'm not sure if they're possible. Firstly, can you have two fixed width divs on the sides of a variable width div, which will stretch to fit the screen? Something like this is generally what I mean: Code: <div style="width: 50px; float: left;">left</div> <div style="width: *; float: left;">middle</div> <div style="width: 50px; float: left;">right</div> Also, is there any way to make a div that has been placed to the right of another match the height of the the one to it's left? Basically, I want it to behave more like standard tables do in that every cell in a row is the same height. Is this possible? I'm having an issue with a CSS layout I"m working on. 1.For some off reason the div element for my page footer appears to think its inside of the mbox div. no matter what I have tried I can't get the pagebot div to the bottom of browser. 2. Width of 100% still leaves 30 or so px's on the right, any reason for this? 3. setting a min-height of 500 or so for mbox or innerbox divs has been ignored. Code: <html> <head> <title>Untitled</title> <style> #container { position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; } #pagetop{ position: relative; top: 0px; background-color: #ADD8E6; width: 100%; height: 65px; } #pagebot { position: relative; background-color: #ADD8E6; height: 65px; clear: both; } #mbox { position: relative; border: 5px solid #000; } #innerbox { position: relative; left: 10px; } div{ border: 1px solid red; } </style> </head> <body> <div id="container"> <div id="pagetop"></div> <div id="mbox"> <div><img src='imgs/logo_tot_grey.jpg' width='280' height='95' alt='' border='0'></div> <div id="innerbox"> <p>Test</p> </div </div> <div id="pagebot"></div> </div> </body> </html> I am looking for a CSS tutorial which teaches how to make a layout like this layout Basically a 3 column layout with boxes in the left and right columns Thanks I've got two pages, one created using tables for layout, and one using css . With the text columns in the tables layout, as you can see, no matter how much text you put in either column, the grey-background container will be pushed down. However, with the text columns in the css layout, I had to float the right column to the right in order to display the two columns together, and therefore, if you have more text in the right floated column, adding more or less text does not push down the height of the grey-background container. Can anyone tell me how I can fix this while allowing for random amounts of text to be displayed in either column, in the layout? Hi there, I wanted to make buttons for my menu but I didn't want to use a lot of bandwidth so I decided to use Layouts and use the same image button over and over again! I made it in FrontPage with a great success but at the end I found out that the layout doesn't work in FireFox, the writing is all over the place in FireFox. Here is the code: Code: <div id="logo" style="position:absolute; left:-1px; top:20px; width: 171px; height: 45px;"> <p align="center"><font face="Tahoma" size="2">TEST LAYOUT</font></div> <p> <img border="0" id="img1" src="../button22.jpg" height="30" width="150" alt=""></p> If you apply it in IE it works, but if you apply it in Firefox it doesn't work. Thanks in advance for your help and support. Best Regards, John i have been for 7 years now developing websites using tables and CSS, and nowadays i realized that i should use <DIV>s to create layout for my websites as it will be faster and SEO friendly. so can you please tell me any tutorials that teach me how to build a website using <DIV>s? and do someone know whether Lynda offers this or not? hey everyone, for years i have been making sites with tables for layouts. i have heard how this is old and a bad method as opposed to css. i do know the basic of css, like changing fonts, properties of buttons, changing link styles, hovering, etc. i was wondering if anyone could reccomend a site that does a good job explaining how to make a layout with css, basically that can replace tables. i have googled and found some ok stuff, but i was wondering if anyone already knows of a helpful resource. i am not in a dire need of an answer here, just curious to expand my knowledge of css. thanks for your help, --c0ldshadow Let me explain a little what I need to do. I need to make table cells use images. Easy enough using background-image. The problem is, I need a left end and right end for the table. make sense? i want to enclose the image so there's an ending on it. The only way I've seen this done is using table layouts. upper row has 3 cells. one on each end for ends, and one in the center for the stretch. Is there a way to do this in CSS, so I can somehow have this drawn out? I mean How's this done? I see it on modules for nuke pages all over the place. But there has to be more to it than physically coding a table each section right? I've been reading over a bunch of threads and CSS vs. table websites & articles, all with varying degrees of CSS fanatiscm to "long-live-tables" viewpoints. I too am trying to make a decision on how to embark on a new site strategy. I think for most developers, re-coding an existing site to full CSS is probably not cost effective. I'm using CSS for everything except positioning right now. So my question is, how are you approaching from-scratch NEW site development layouts? Is it more common practice to place all div's within one div as seen he Or to have all div's independent, as shown he So here is my question and dilemma. In almost every design you want the same layout for all the pages so one css style sheet is really all that is needed unless you are providing a different browser support or a different media option. However, lets say inside that site you want a page that will have a photo gallery or embedded videos. So then you may need to lay out a bit of a different layout for that page and its content. Is it better to just have those declarations in the same external style sheet, then applying it to that one page; or should it be placed in a separate css style sheet just for the page or because it is so isolates should it be placed in the xhtml internally? I would think placing in in the xhtml would not be a good idea but the other two options is bit more gray LB Alright, so ive been around the block for a while and have heard that table layouts for design are the worst thing possible. However, I have noticed more and more sites using tables for the block type layout in a site... and then using css within the table blocks. I tried it out on a site I'm working on, and it is honestly the easiest way I've ever made a template... and it works in IE6 & 7, and FF. One of my favorite sites and layouts is CBSSports. And they use a table layout to accomplish what they are doing. Any reasons on why it is really that bad to do for example, what CBSSports is doing? I'm trying to make a page with HTML 4 Strict and CSS, but one part has been giving me trouble. For now, I have a <TABLE> like in HTML 3.2 since nothing else has worked. The page already uses CSS, and the <TABLE> does live within a <DIV>. The page uses an external .css file. The table begins with <tr><td colspan="3"> where you find header text and a small (69x42) image. I prefer the image right of the text, but it doesn't have to be. The third row is the same, except there is no image with the footer text. The middle row has 3 TD's (columns). The left and right columns each have a cluster of images and no text. Each image is about 80x80 (slight variations), and I prefer having 2 images per image row. These images don't need to align with the text in any particular way. The middle column has all of the text, and it has no images. What would I need to do to get this layout to work in CSS rather than a <TABLE>? |