CSS - Lines Connecting Divs
[EDIT]COME ON GARY AND KRAVVITZ [/EDIT]
First off, don't mind my usage of selectors. I will explain. Time to turn the tables and ask some help.. Never thought I would have to ask a CSS question (it's more logic then CSS anyway)but if you look at here you will see a sample quiz on Sitepoint (number 13) in which there are lines connecting the divs. I still have some work to do on the general layout, but all I need in that is more time. I can not edit the HTML in the body section, which is why I am using such selectors. Obviously I have to use borders to achieve this effect but I need a little guidance. Page in question is http://www.devwebsites.com/temp/ Code for the lazy is he Code: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Organisation Chart</title> <style type="text/css"> *{margin:0;padding:0;margin:0 auto;} body{ text-align:center; overflow-x:hidden; } h2{ font-size:12px; text-align:left; font-weight:normal; margin:15px 0 0 20px; } ul{ list-style-type:none; color: #000066; } ul li dl dt{ color: #000066; font-weight:bold; } dl{ width:200px; } body>dl{ width:150px; border: 1px solid #000066; margin-top:25px; background-color: #DDEEFF; padding:4px; } body>dl>dt{font-weight:bold;} body>ul+li{ border:1px solid #000066; position:relative; left:-22px; } body>ul+h2+ul>li>dl>dt{ background-color: #778899; width:200px; float:left; color:white; } dt.sub+dd>ul>li{ width:200px; border:1px solid #000066; background-color: #DDEEFF; } body>ul+h2+ul>li>dl>dt+dd{ background-color: #DDEEFF; } body>h1+dl+h2+ul>li{ border:1px solid #000066; text-align:left; width:120px; float:right; position:relative; right:30%; padding:6px; background-color: #DDEEFF; } body>h1+dl+h2+ul>li+li{ left:-47%; } body>ul+h2{clear:both;top:20px;position:relative;} body>ul+h2+ul>li{ float:left; } ul>li>dl>dt+dd{ text-align:left; } body>ul+h2+ul>li>dl{ border-right:25px solid white; position:relative; left:236px; top:25px; } </style> </head> <body> <h1>Organization</h1> <dl> <dt>President</dt> <dd>A. Andrews</dd> </dl> <h2>Support Staff</h2> <ul> <li> <dl> <dt>Vice President</dt> <dd>B. Burns</dd> </dl> </li> <li> <dl> <dt>Secretaries</dt> <dd>C. Colins</dd> <dd>D. Dylan</dd> </dl> </li> </ul> <h2>Divisions</h2> <ul> <li> <dl> <dt>Economy</dt> <dd> <dl> <dt>Manager</dt> <dd>E. Ericson</dd> <dt>Secretary</dt> <dd>F. Fitzgerald</dd> <dt>Employees</dt> <dd>25</dd> </dl> </dd> </dl> </li> <li> <dl> <dt>Marketing</dt> <dd> <dl> <dt>Manager</dt> <dd>G. Glockstettner</dd> <dt>Secretary</dt> <dd>H. Holmes</dd> <dt>Employees</dt> <dd>14</dd> </dl> </dd> </dl> </li> <li> <dl> <dt>Products</dt> <dd> <dl> <dt>Manager</dt> <dd>I. Irkwell</dd> <dt>Secretary</dt> <dd>J. Jones</dd> <dt>Employees</dt> <dd>89</dd> <dt class="sub">Subdivisions</dt> <dd> <ul> <li>Manufacturing</li> <li>Quality Assurance</li> </ul> </dd> </dl> </dd> </dl> </li> </ul> </body> </html> Similar TutorialsOk, so I've learned to stay away from tables when you don't need them, and I have an instance where this is the case. I have a container div that has a header, content and a footer. On my home page, I have to divs next to each other with the same height and a div below them towards the right. To simplify my problem, look at this example. Code: <html> <body> <div style="float:right"> Hello there! </div> <hr> </body> </html> If there's a "float:right" on that div, the hr tag below doesn't get pushed down. But if I use relative positioning and don't use the floats, I can't put the two top divs next to each other. The other option is to use absolute positioning, but again content below doesn't get pushed down correctly. It seems that using "clear:both" works, but it seems weird that this has to be done. For example if I have floating divs in a container, I can get them to stretch out the container like so: Code: <html> <body> <div style="border: 1px solid #000; "> <div style="float:right"> Hello there!<br /> Hello there!<br /> Hello there!<br /> Hello there!<br /> Hello there!<br /> Hello there!<br /> Hello there!<br /> </div> <div style="clear: both"></div> </div> <hr> </body> </html> Am I missing something fundamental here? Is there a better solution? Thanks in advance. Centering DIVs inside other DIVs in Firefox? Can it be done in a straight forward way? Setting the inner DIVs float to none seemed to work for IE but not FF. Here's the site in Question: http://www.winchps.vic.edu.au It's a standard fixed width floated DIV columns with a wrapper. One thing it does have is a second DIV inside both columns to display the Gradient background over the top of the repeated background. It works perfect in Firefox & IE7 (with a tweak) but IE6 mkes the sidebar nested div drop below the original sidebar DIV click here for a screenshot for those lucky enough not to have IE6. Here's the CSS code for the basic layout: Code: body { font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif; font-size: 12px; text-align: center; margin: 0px 0px 60px 0px; padding:0px; border: 0; line-height: 2; } #header { width: 802px; } #wrapper { width: 802px; margin:0px; padding: 0px; text-align: left; margin: 0 auto; background: url(images/bodybg.jpg) center repeat-y; } #content { padding: 0px; margin: 0px; } #maingrad { background: url(images/winchcontentgrad.jpg) top left repeat-x; padding: 10px; } #main { width: 589px; float: right; background: url(images/winchcontentbg.jpg) repeat; border-left: solid 1px #000; border-right: solid 1px #000; } #mainstop { width: 589px; float: right; background: url(images/winchcontentbg.jpg) repeat; border-left: solid 1px #000; border-right: solid 1px #000; border-bottom: solid 1px #000; font-size: 10px; } #sidebargrad { background: url(images/winchsidebargrad.jpg) top left repeat-x; padding: 10px 5px 0px 10px; } #sidebar { width: 200px; float: left; background: url(images/winchsidebg.jpg) repeat; line-height: 2; font-size: 14px; border-left: solid 1px #000; border-right: solid 1px #000; } I obviously need to put a conditional comment in there, same for what I did for the minor IE7 tweak, but I'm struggling to suss out what's causing it, I haven't found the specific issue on any of the regular sites (PIE etc). Anyone got any ideas? The Example I've read a bunch about how div's won't stretch to accomidate div's inside of them if they overrun the height/min-height set for the container div. How do I get around this? You can see the skeleton of the site above. It's fine unless you resize the window smaller than the content. I have finished my transparency box backgrounds.. and, thanks to some help here.. have them working in multiple browsers.. Now, I have received a call.. that one person sees "black lines" through the boxes on the transparent boxes on the attractions and info pages.. (user is using IE and 1024x768) -I cannot recreate this problem on any machine.. is there some little strange bug that causes this on certain browsers? http://www.tkwebbiz.com/Gina2 Thanks so much.. *again*.. *Smiles* Anyone knows of a method to cause a vertical line to come all the way down ? Currently it stops where the text stops. but i want it to go all the way to the buttom of the document regardless of the text. (right now i use box border on one side) Thanks! Here is my html for my tables Code: <div id="Content"> <p class='instructions'>Click a column header to sort the table.</p> <div spry:region="jdmba"> <div spry:state="loading" class="loading">Please wait while alumni data loads…</div> <table width="680px" class="spry" cellspacing="0"> <tr> <th scope="col" width="113px" class="sortable" spry:sort="last" id="last">Last Name</th> <th scope="col" width="106px" class="sortable" spry:sort="first" id="first">First Name</th> <th scope="col" width="257px" class="sortable" spry:sort="account" id="account">Company</th> <th scope="col" width="66px" class="sortable" spry:sort="state" id="state">State</th> <th scope="col" width="69px" class="sortable" spry:sort="hls_year" id="hls_year">JD</th> <th scope="col" width="69px" class="sortable" spry:sort="hbs_year" id="hbs_year">MBA</th> </tr> </table> <div class="Overload"> <table width="680px" class="spry" cellspacing="0"> <tr spry:repeat="jdmba" spry:setrow="jdmba" spry:odd="odd" spry:even="even" spry:hover="hover" > <td width="113px">{last}</td> <td width="106px">{first}</td> <td width="257px">{account}</td> <td width="66px">{state}</td> <td width="69px">{hls_year}</td> <td width="69px">{hbs_year}</td> </tr> </table> </div> </div>....... Here is my CSS Code: .Content { font: 14px/normal Georgia, "Times New Roman", Times, serif; text-align: justify; display: block; padding: 2em 3em 3em; } .Overload { height: 208px; overflow: auto; } .odd { background-color: #E8E8E8; } .even { background-color: #E8E8E8;} .hover { background-color: #FFC;} table.spry { font-family: Verdana; font-size: 12px; line-height:20px; cursor: pointer; } .instructions { font-family: Verdana; font-weight:bold; font-size: 12px; line-height:20px; cursor: pointer; margin-bottom:8px; } .loading { font-family: Verdana; font-weight:bold; font-size: 12px; line-height:20px; cursor: pointer; margin-top:0px; margin-bottom:8px; color:#900; } table.spry th {border-left: 1px solid #000000; border-bottom: 1px solid #000000; border-top: 1px solid #000000; font-family:Verdana; } table.spry td {border-left: 1px solid #000000; border-bottom: 1px solid #000000; font-family:Verdana; } table.spry th.sortable:hover { cursor: pointer; } table.spry th.sortable { text-align:left; color:#FFFFFF; background: #8F001C url(../SpryAssets/bg.gif) no-repeat 95% 6px; } table.spry th.ascending { background: #8F001C url(../SpryAssets/SpryMenuBarUpHover.gif) no-repeat 95% 8px; } table.spry th.descending { background: #8F001C url(../SpryAssets/SpryMenuBarDownHover.gif) no-repeat 95% 8px; } I guess I was under the impression if I made them all the same lengths and the table width the same that everything would then lineup just fine. The other thing is that on IE it is not lined up one way and on FF it's not lined up again, but it's different. I would like to upload some images to show my problem. How do I go about putting an image up for you to see what I'm talking about? When I try to insert an image it doesn't give me an option to upload an image from my machine. Thanks! When printing pages from this site http://www.sorensteensen.dk/kvl/ one or two lines disappear when the pages break. I have no idea why. Anyone knows about it? Soren Steensen Hi, I am writing a code for form: Code: private name: <input size="10" name="private_name" type="text"> last name: <input size="10" name=last_name" type="text"> I want to increase the space between the two lines I tried to use the css line-height and it did increase the vertical space between the two lines. However only in the part of the words. In the case of the two input boxes instead of more space they become "taller", I can understand the logic behind this, what I don't know is a way to increase the vertical space between the two lines that will work in the case of the input boxes as well. How can I solve this? Thank in advance Am I commenting lines incorrectly? If I prefix a line with two slashes // in the CSS, firefox will ignore it. IE will recognize it and perform the CSS styling. For instance: Code: table.myTable tr td { background-color: red; //background-image: url('mypic.jpg'); } The TD element will not have a background in firefox. It WILL have the background image in IE. P.S. I am using IE8 on Win7 RC1 (build 7100). Thank you Thanks for taking the time to read my question. I am trying to make a new page layout. I have one main box on the left [float: left;], and 3 stacked smaller boxes on the right [float: right;] I would like 2 lines joining the box on the left to the center box on the right. I'm trying to do this with a container that only has top and bottom borders. I don't know how to get the horizontal lines centered vertically. Also, the page layout works great in FF but not in IE. Not really sure why. Any suggestions on how to do this? oh and the green and red colors are only for development so they stand out. Thanks, Brad HTML: Code: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="description" content=""> <meta name="keywords" content=""> <meta name="author" content="piercedjunkmail@hotmail.com"> <meta name="generator" content="AceHTML 5 Freeware"> <link href="TestLayoutCSS.css" rel="stylesheet" type="text/css" /> <title>Test Layout 1</title> </head> <body> <div id="HeaderContainer">hi</div> <div id="RightTopContainer">hi</div> <div id="PageTitle">This is the title of the page</div> <div id="MajorLeftMainContainer"> <div id="LeftMainContainer">hi</div> <div id="HorizontalLines"></div></div> <div id="RightCenterContainer">hi</div> <div id="RightBottomContainer">hi</div> </body> </html> CSS: Code: @charset "iso-8859-1"; body { font-family: Foo, times, serif; margin: 0px; background-color: #4F9FC5; } #HeaderContainer { height: 50px; width: 100%; /*border-color: green; border-style: solid; border-width: 2px;*/ } #MajorLeftMainContainer { /*border-top-color: #FFFFFF; border-left-color: #FFFFFF; border-bottom-color: #C0C0C0; border-right-color: #C0C0C0; border-style: solid; border-width: 5px;*/ float: left; margin-top: 90px; margin-left: 10px; width: 67%; height: 310px; background-color: green; } #LeftMainContainer { border-top-color: #FFFFFF; border-left-color: #FFFFFF; border-bottom-color: #C0C0C0; border-right-color: #C0C0C0; border-style: solid; border-width: 5px; float: left; /*margin-top: 90px; margin-left: 10px;*/ width: 80%; height: 300px; background-color: #EAEAEA; } #RightTopContainer { border-top-color: #FFFFFF; border-left-color: #FFFFFF; border-bottom-color: #C0C0C0; border-right-color: #C0C0C0; border-style: solid; border-width: 5px; float: right; margin-top: 30px; margin-right: 10px; width: 30%; height: 150px; background-color: #EAEAEA; } #RightCenterContainer { border-top-color: #FFFFFF; border-left-color: #FFFFFF; border-bottom-color: #C0C0C0; border-right-color: #C0C0C0; border-style: solid; border-width: 5px; float: right; margin-top: 50px; margin-right: 10px; width: 30%; height: 150px; background-color: #EAEAEA; } #RightBottomContainer { border-top-color: #FFFFFF; border-left-color: #FFFFFF; border-bottom-color: #C0C0C0; border-right-color: #C0C0C0; border-style: solid; border-width: 5px; float: right; margin-top: 50px; margin-right: 10px; width: 30%; height: 150px; background-color: #EAEAEA; } #PageTitle { font-size: 25px; font-family: arial, times, serif; /*border-color: green; border-style: solid; border-width: 2px;*/ width: 340px; height: 35px; margin-top: 40px; margin-left: 25px; color: black; font-variant: small-caps; } #HorizontalLines { border-top-size: 2px; border-top-color: red; border-top-style: solid; border-bottom-size: 2px; border-bottom-color: red; border-bottom-style: solid; float: left; width: 124px; height: 30px; vertical-align: middle; } CSS Validator Two lines of CSS won't validate because they are used to fix a navigation issues in IE. Without those two lines there is a huge height gap between each list element in IE. Anyway I can hide these two lines from the validator? I had a webpage where there were rows with three boxes on, that all floated left. After the third there was a line break and then the next line also had three boxes, etc. The boxes all have the same width, but different heights (not dramatically different). I am now wanting to allow the number of boxes on the line to vary with the width of the browser window. By removing the break every three lines this would work if all the boxes were the same height. As they are not, the box that should go onto the next line down might go down and a bit to the left before being "stopped" by a taller box. I expected this behaviour, but I'm not sure how to go further and get around it. Thanks for any ideas, Thomas Hi there, I would like to get some opinions on what would be the best way, or even a good way, to display a list of lines from a database, such as product descriptions (a link), prices (text) and buy now links. For example: Segate Hard Drive 250gb $150.00 Buy Now Maxtor Hard Drive 300gb $200.00 Buy Now etc I thought it would be best to have a <ul> with each line being an <li>. Further to this, I tried having each line as a <li> element, with each column (price, buy now etc) an <li> element, displayed inline. This actually worked well, but I had trouble doing an alternate background color thing, which I think was due to my funny css code. I gave each <li> a class selector, so that different formatting could be applied, and I had each <li> float:left; and a width, to give a column style display. Would a table be the best way to display the 3 (or more) columns? I've removed tables from the site layout, and can see how they would make sense for this, as it basically is tabular data, repeated over and over again. Or would having each line as a <p> with say each column having its own <label> possibly be best? Or some variation on of the 3, or something else all together? I realise everyone would have their preferred style and there is no 'best', 'right or wrong' way etc. I'm trying to find a way that I can work with, one that could be considered 'the norm', or 'best practise'. I haven't posted any code, but can if people need more of an idea of what I am trying to do. Cheers Scott Ok, so I've finally made a design that I think looks OK, and the one last problem that I've come across is that IE(7) is adding some space at the edges of my divs, but it looks just how it should in Firefox: http://chipchamp.awardspace.com/webtemps Look at it in firefox and IE, and you'll see what I mean.. Here is the entire code for the page: Code: <html> <head> <style type="text/css"> body { background-image: url(images/design_5x1.gif); text-align:left; } div { border-width:0px; margin:0px; padding:0px; } #main-wrapper { background-color:transparent; width:800px; margin-top:50px; } #header { background-color:transparent; background-image:url(images/design_3x3.gif); width:800px; height:102px; } #content { background-color:#ffffff; width:100%; height:700px; } #menu { background-color:#ffffff; width:33%; float:left; } #content2 { background-color:#ffffff; width:60%; float:right; } #footer { background-color:transparent; background-image:url(images/design_7x2.gif); width:100%; } #footer-content { background-color:transparent; background-image:url(images/design_7x2.gif); width:680px; height:40px; } img.left { float:left; } img.right { float:right; } </style> </head> <body> <center> <div id="main-wrapper"><div id="header"><img class="left" src="images/design_3x2.gif"> </img><img class="right" src="images/design_3x6.gif"></img> <img class="right" src="images/design_3x5.gif"></img> <img class="right" src="images/design_3x4.gif"></img></div> <div id="content"><div id="menu"><img class="right" src="images/design_4x2.gif"></img></div> <div id="content2">hi again</div></div> <div id="footer"><img class="left" src="images/design_7x1.gif"></img> <img class="right" src="images/design_7x4.gif"></img><div id="footer-content">Copyright (c) 2008 ChipChamp Studios</div></div></div> </center> </body> </html> I have found out that if I comment out the background-image lines in #header and #footer, then the ugly white lines on the sides go away -- but so does some of the background image in the middle of the header/footer. So, does anyone have any idea how to fix this? It would be a great help! If you can fix the problem for either the header or the footer, I should be able to fix it for the other, so you don't have to fix both. Thanks! I have a repeating background image, that is very much driving me crazy. There is a line when the image repeats. I cannot figure out what the problem is. Below is an example, the image in the box is slightly shorter which is where you see the line. (URL address blocked: See forum rules) Thanks for any help. I need some help. I am a relative beginner with CSS and have a problem that is eluding me. Specifically in the right-hand sidebar on this page (FriendsAcrossTheWater.org/blog), you will note that all the links are on separate lines by themselves. I do not want this behavior and I am not sure what is causing it nor what to do to correct it. Can you help? Thanks, Bob Ross I was wondering if anyone knows how to get a space between blocks in a list. If you have list that have more that one line in a block it looks better to have gaps greater than the leading to separate them. I can't figure how to accomplish this, does anyone have any ideas. Hi: After entering data into a database from a form (HTML) using php, I now have to retrieve the data, place it in a form style and print. Everything works fine when I do the print except for one thing. Description of Problem: When I print using IE 6.0, all vertical and horizontal lines which separate data from each other (cells) print. When I do the print in Mozilla, only the horizontal lines appear. How can I fix this, or, what makes it do this in Mozilla and not in IE? There is one thing I'm not doing, I'm not using CSS to format the form. Could this fix the problem? Any suggestions will be greatly appreciated! Thanks! Argh! I want to have a little icon as a link with a caption under it. It should be a no brainer. Like this: PHP Code: <a class="a" style="line-height: normal;" href="http://www.oregonetail.com/etail.html"><img src="/images/heart_innovation_icon.jpg" height="60" width="39" alt="heart innovation poster" border="0" />E-tail Neighbors</a> Here's the thing, there's a GAP between the graphic and the caption, and if the caption has to go an extra line because of the width constraint of the <div> that this is in, there's a huge GAP between the lines. I want the caption BUTT UP against the bottom of the picture and if the caption wraps, I want the second line of it BUTT UP against the first one NO GAP. I've been twiddling around with line-height but NOTHING I DO alters this in the slightest. BTW the "a" class is nothing but font-size: .75em my next test is to take that out and see if that helps, but I don't have a clue what is the root cause of this. This should be so ffing basic!!! Removing the "a" class didn't work. Here is a little context: Code: <div> <div style="width:88px; float:left" > <a href="https://estore.villageprofile.com/itemdetail.cfm?nItemid=546&viewby=exhibit&nexhibitID=2&subview=37" target="_blank"> <img src="/images/corv_ebook_cover.jpg" style="width:88px; height:100px" border="0" /> <span class="a" style='line-height: .5;'>FREE Town Guide</span></a> </div> <div style="float: left; width:50px;"> <a href="http://www.corvallisiba.org"><img src="/images/ciba_tiny.jpg" height="33"; width="50" alt="ciba logo" border="0" /> <span style='line-height: .5;'>CIBA Member</span></a> </div> On one of them I took the span out in case *THAT* was causing it and applied the styles to the "<a" tagged item as in the first exmple. NOTHING changed. PLEASE HELP! |