CSS - Div And New Line
i have a series of divs that look like this
Code: <div> <div></div> <div></div> </div> <div> <div></div> <div></div> </div> Each of the inner divs use the float attribute but when it comes to the second outer div it doesnt automatically go onto the next line it sort of continues from where the last div left off. Why is this... Similar TutorialsI've got two lines of text. Want the spacing the two lines to increase, so I set a line-height. When I do this, not only does it increase space between the two lines, it also increases spacing above the first line (and maybe below the second). How can I increase spacing between the two lines only, without increasing above and below? Thanks! Greetings, I am relatively new to CSS and am using background image bullets. Problem is, in the case of a two line link, the bullet aligns in between the two lines and I need it to align to the top line. Below is the CSS, and attached is a screenshot of the link to better illustrate my predicament. Thanks for any help! li { list-style-type: none; background: url(../images/bullet.gif) no-repeat left; padding: 0 0 0 10px; } Greetings, I have a class called "header" and I am trying to give it a touch of extra space between it and the next line. All of my headers are just a few words and thus on one line. I tried placing "line-height: 1.5em" in my "header" class and it shows up correctly in Dreamweaver but not in IE. My thought is, because it is only a single line, that class value does not kick in because there is no second line for that class. Is there a way to conrol this in CSS or am I going to have to resort to using a....gulp.....spacer? Thanks in advance! Hi all, How to go to next line if the width of the content is more than specified width? Thanx/Chandar Hello, At my blog test site You'll notice the Quote: << Hello World! | Gettin' Closer >> text in the middle. Just as you see it above, I'd like that all on one line, but can't seem to figure out how to do it. Driving me nuts. Anyone? The CSS code controlling that is Code: .alignright { text-align: center; display: inline; } .alignleft { text-align: center; display: inline; } Thanks! Chris Hello, I use always use the <br /> tag and I just found out in using the clearing of divs like; Code: <div style="clear:both; margin-top:5px"></div> for next line or breaking of line. Is this a good thing to use? Thanks for taking the time to read my question I have a row of pictures as nav links, and under them I want to put a row of text stating what each link is Picture Picture Picture Picture Text Text Text Text Each pic is 52px wide, so I made the containers for the text 52px wide. both have left and right margins of 10px (I made the .NavText margin 11 to compensate for the 1px border) yet they don't line up!! What am I missing? Thanks, Brad html 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"> <head> <meta name="description" content="Canada Carriage - A supplier of great carriages from XXXXXXX." /> <meta name="keywords" content="Horse drawn vehicle, Carriages, Carts, Horse carriages, Horse carts, Coyaltix, Manitoba, Canada, Dealer, Equine, FEI, CDE, Combined Driving Event, Pleasure driving, Competition driving, Custom made, Fine quality, Affordable prices, European manufactured, Drive Canada" /> <meta name="Revisit-After" content="7 Days" /> <meta name="Robots" content="index, follow" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Canada Carriage</title> <link rel="stylesheet" type="text/css" href="LC.css" media="screen" /> </head> <body> <div class="MainCont"> <img class="HomeLogo" src="images/logo.jpg" /> <div class="NavHolder"> <a href="LisaClarkDesigns_About.htm"><img class="ImgNav" src="images/AboutNav.gif" alt="Click here to navigate to the About Lisa Clark Designs page." /></a> <a href="LisaClarkDesigns_Portfolio.htm"><img class="ImgNav" src="images/PortfolioNav.gif" alt="Click here to navigate to the Lisa Clark Designs Portfolio page." /></a> <a href="LisaClarkDesigns_Fees.htm"><img class="ImgNav" src="images/FeesNav.gif" alt="Click here to navigate to the Lisa Clark Designs Fees page." /></a> <a href="LisaClarkDesigns_Contact.htm"><img class="ImgNav" src="images/AboutNav.gif" alt="Click here to navigate to the Lisa Clark Designs Contact page." /></a> <div class="NavText">About</div> <div class="NavText">Portfolio</div> <div class="NavText">Fees</div> <div class="NavText">Contact</div> </div> </div> </body> </html> css Code: body { background-color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; margin: 0px; padding: 0px; } .MainCont { width: 800px; margin: 0px auto; padding: 0px; } img.HomeLogo { margin-left: auto; margin-right: auto; margin-top: 200px; margin-bottom: 0px; display: block; } img.ImgNav { border: 1px solid #999999; padding: 0px; margin: 0px 10px 0px 10px; width: 52px; } .NavHolder { margin-left: auto; margin-right: auto; margin-top: 100px; margin-bottom: 0px; padding: 0px; display: block; width: 314px; background-color: orange; } .NavText { padding: 0px; margin: 0px 11px 0px 11px; width: 52px; color: #ffffff; font-size: 12px; float: left; display: inline; background-color: red; } I was just coding this: and all the links appear on new lines... why is that? ARGH! I cant post links just type this: blumoney. latestdot. net/ plb/ pictures. php without the spaces and enters I have a left-hand side nagivation TD containing plain-text links. The TD is a fixed width and I want to be able to indent automatically the second line of text in a link should the text for the text for the link exceed the fixed width of the TD. Anyone know how to achieve this effect? An example of what I might want it to look like... Code: Link one Link two A longer link three Link four i need to justify a single line of text. As there is text-align-last in IE it works perfectly.. but i need it to be cross browser - ie. FF and Safari.. so this is not the sollution.. as i got just a certain number of links i've tried this way: Code: <div class="table"> <div class="tr"> <div class="firsttd"><a href="">link</a></div> <div class="td"><a href="">link</a></div> <div class="td"><a href="">veri long text</a></div> <div class="td"><a href="">link</a></div> <div class="td"><a href="">link</a></div> <div class="td"><a href="">long text</a></div> <div class="td"><a href="">link</a></div> <div class="td"><a href="">link</a></div> <div class="lasttd"><a href="">link</a></div> </div> </div> simulation the table through CSS : Code: .table { display:table; width: 100%; } .tr { display:table-row; } .td { display:table-cell; text-align: center; background-image: url(images/redbg.gif); background-position: right; background-repeat: no-repeat; } .firsttd { display:table-cell; text-align: left; background-image: url(images/redbg.gif); background-position: right; background-repeat: no-repeat; } .lasttd { display:table-cell; text-align: right; } but another problem shows up.. when the link text is long.. the cell width is not set equally - i.e. it goes too long and IE6/7 doen't displays it correctly - it goes vertically instead of horizontally.. here a live link: http://89.215.52.231/templates/26/ i'm talking about the black footer navigation.. I need to implement ASP .NET form with few radiobuttons. The RadioButton1.Text is set in .cs file. I would like to configure it so that if text is too long it won't extend to 2 lines, but is clipped and have ellipses. I can't make it work. I read about it should has some nowrap defined and overflow: hidden; text-overflow:ellipsis defined somewhere. The problem is i don't know where! Plz help me! I want products listed horizontally first, then move to next line if there is to many. But instead, each product listed on a new line. http://www.refinethetaste.com/html/default.asp?Section=products&CATEGORYID=4 PHP Code: /* products.css */ #products { float: left; } #products .productbox { background-color: #ececec; width: 150px; padding: 10px; margin-top: 10px; } #products .productfooter { background: url(../images/arrow.gif) 20px 0 no-repeat; padding-left: 58px; margin-bottom: 10px;} #products img#product { width:150px; height:150px; border: 0px; } hey guys i have a question.. i wan't to make a picture gallery for my cus(tattoo) im doing an admin so he can upload his pics. now on the gallery page i will use php to echo the pictures. now when you use an echo usally it showws all the pics on on line.. how can i make it so i can have like 4per line? pic pic pic pic pic pic pic pic Hey there. Is it possible to add a line break so that the following markup... html Code: Original - html Code <dl> <dt>Posts:</dt> <dd>33</dd> <dt>Topics:</dt> <dd>4</dd> </dl> <dl> <dt>Posts:</dt> <dd>33</dd> <dt>Topics:</dt> <dd>4</dd> </dl> ...looks like this? Posts: 33 Topics: 4 Basically, I want it to be like display: block, but only to the RIGHT of the text. Does that make sense? Just like adding a <br />, but with different HTML. Hi. Here is my code: Code: <?php echo $this->getPriceHtml($_product, true) ?> <?php if($_product->isSaleable()): ?> <button class="form-button" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><?php echo $this->__('Add to Cart') ?></span></button> <a href="#" class="buttony"><span class="stock">In stock</span></a> <?php else: ?> <a href="#" class="buttony"><span class="nostock">Out of stock</span></a> <?php endif; ?> <a href="#" class="buttonx"><span class="<?php echo $_product->gettesting() ?>">This item is Brand <?php echo $_product->gettesting() ?></span></a> This works perfectly, however, even though there is room for both the In Stock / Out of Stock button and the Mandatory / Optional Button, they sit one under the other, even though there is no <br />. I want them to sit on the same line. How can this be achieved? I can't get IE7 or IE6 to look corectly. IE8 and other browsers appear to be fine. Any suggestions? html: 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 id="ctl00_ctl00_ctl00_ContentPlaceHolderDefault_head"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>HOME - My Company </title> <link rel="stylesheet" type="text/css" href="/css/CC_Style.css" /> </head> <body> <div id="wrapper"> <div id="main"> <div id="bannerHolder"> <img id="banner" src="../media/108/banner_home.jpg" alt="" /> <div id="banner2"> </div> </div> </div> <div class="clearfix"> </div> <div id="footer"> Copyright @ 2002-2010, My Company, Inc. <a href="#">PRIVACY STATEMENT</a> | <a href="#">SITEMAP</a> </div> </div> </body> </html> CSS Code: /*LAYOUT*/ *{ padding: 0px; margin: 0px; } body { text-align: center; background-image: url(../images/bg.gif); background-repeat: repeat-x repeat-y; } #wrapper { margin: auto; text-align: center; width: 960px; background-color: #FFF; } /*--------------- B A N N E R S --------------*/ #bannerHolder { padding: 0; margin: 0; border: 0; text-align: left; background-color: #fff; height: 198px; } #banner { width: 655px; height: 198px; } #banner2 { float: right; height: 198px; background-color: #e5f2fb; width: 304px; } /*--------------------- M A I N -----------------------*/ #main { background: #fff; height: 300px; } #news /* News Bar for Banner DocTypes */ { border-left: solid 1px #ccc; float: right; margin: 15px 0 15px 0; padding: 0 15px 0 15px; width: 274px; height: 350px; } /*--------------------- F O O T E R -----------------------*/ #footer { height: 22px; line-height:22px; font-size: 10px; color: #aaa; border-top: solid 1px #ccc; text-align: right; padding-right: 15px; } #footer a { font-family: Arial, Helvetica, sans-serif; color: #3a80a2; } /*----------------- F I X E S -----------------*/ .clearfix { clear: both; } Hi I have a classic CSS:- ul.none { FONT-SIZE: 70%; line-height: 10pt; COLOR: #000000; list-style-position: intside; list-style-type: none; font-family: Verdana, Arial, Helvetica, sans-serif; position:relative; width:150px; padding:10px; text-align:center; BACKGROUND-COLOR: #EDF5F5; border: 1px solid #0000000; } AND THE HTML:- <ul class="none"> <li>NEWS 1</li> <li>NEWS 2</li> <li>NEWS 3</li> <li>NEWS 4</li> <li>NEWS 5</li> </ul> I want to have a larger gap between each <li> item, without using a <p> or a <br>? Line height or spacing does not work, it spaces out everything. E.g if the text in the <li> is longer than a line it makes this line higher, which means it looks well daft if you see what i mean. because everything is so spaced out. Margin and Padding do not work for what i wish to achieve. Could anyone Help please. how can i keep these 2 divs i have on the same line, i tried min-width for the div they are in and it works perfect but IE doesn't support it, i even tried a extra div to use as a spacer but IE seems to make keep them on the same line even though there is already enough space for it, here is the html i'm using Code: <div id="ms_all" ><!-- Start all mapserver --> <div id="ms_main_map_div"> <input alt="Map" id="ms_main_image" type="image" name="mapa" src="map_img.phtml?[data_to_img]" /> </div> <div id="ms_side_bar" > <!-- A bunch of form stuff --> </div><!-- End Side Bar --> </div><!-- End all mapserver --> and here is the css Code: #ms_all { /*padding:5px;*/ height:610px; min-width:810px; position:relative; } #ms_main_map_div { padding:2px; left:5px; float:left; /*top:2px;*/ width:600px; } #ms_main_image { cursor:crosshair; width:600px; height:600px; } #ms_side_bar { right:2px; float:right; padding-top:20px; /*top:10px;*/ padding:2px; width:200px; /*clear:both;*/ } i want the 'ms_main_map_div' and the 'ms_side_bar' to be on the same line, but the 'ms_side_bar' stuff keeps jumping to the bottom of the page if it doesn't fit in the window, so does anyone know of a way to get IE to display this the right way or maybe make IE support the min-width thing, preferably keeping my CSS and XHTML valid How do I create two div blocks that lay side by side from each other? Right now I have two "column" divs (one left and one right), and separate "box" div that contain the content. CSS: Code: div#frame { width: 40%; margin-top: auto; margin-bottom: 50px; margin-left: auto; margin-right: auto; border-style: solid; border-width: 5px; border-right-color: black; border-bottom-color: black; border-left-color: white; border-top-color: white; } div#title { width: 100%; background-color: black; color: white; } div.box { width: 100%; border-style: solid; border-width: 5px; border-right-color: black; border-bottom-color: black; border-left-color: white; border-top-color: white; } div#left { width: 45%; } div#right { width: 45%; margin-left: 50%; } HTML: Code: <div id="frame"> <!---------------------------> <div id="left"> <div class="box"> <div id="title">NEWS</div> fsdf ksdlfj klsdjf l;ksdjf skdfj sdf klsdf klsdf jksd jksdfjklsdf kljsdfjkl sdl;ksdfj l;ksd flsdf sdf sdfjklsdf jklsd jklfsdf ksdlfj klsdjf l;ksdjf skdfj sdf klsdf klsdf jksd jksdfjklsdf kljsdfjkl sdl;ksdfj l;ksd flsdf sdf sdfjklsdf jklsd jklfsdf ksdlfj klsdjf l;ksdjf skdfj sdf klsdf klsdf jksd jksdfjklsdf kljsdfjkl sdl;ksdfj l;ksd flsdf sdf sdfjklsdf jklsd jklfsdf ksdlfj klsdjf l;ksdjf skdfj sdf klsdf klsdf jksd jksdfjklsdf kljsdfjkl sdl;ksdfj l;ksd flsdf sdf sdfjklsdf jklsd jklfsdf ksdlfj klsdjf l;ksdjf skdfj sdf klsdf klsdf jksd jksdfjklsdf kljsdfjkl sdl;ksdfj l;ksd flsdf sdf sdfjklsdf jklsd jkl</div> <div class="box"> <div id="title">RECENT GAMES</div> fsdf ksdlfj klsdjf l;ksdjf skdfj sdf klsdf klsdf jksd jksdfjklsdf kljsdfjkl sdl;ksdfj l;ksd flsdf sdf sdfjklsdf jklsd jkl</div> </div> <!---------------------------> <div id="right"> <div class="box"> <div id="title">NEWS</div> fsdf ksdlfj klsdjf l;ksdjf skdfj sdf klsdf klsdf jksd jksdfjklsdf kljsdfjkl sdl;ksdfj l;ksd flsdf sdf sdfjklsdf jklsd jklfsdf ksdlfj klsdjf l;ksdjf skdfj sdf klsdf klsdf jksd jksdfjklsdf kljsdfjkl sdl;ksdfj l;ksd flsdf sdf sdfjklsdf jklsd jklfsdf ksdlfj klsdjf l;ksdjf skdfj sdf klsdf klsdf jksd jksdfjklsdf kljsdfjkl sdl;ksdfj l;ksd flsdf sdf sdfjklsdf jklsd jklfsdf ksdlfj klsdjf l;ksdjf skdfj sdf klsdf klsdf jksd jksdfjklsdf kljsdfjkl sdl;ksdfj l;ksd flsdf sdf sdfjklsdf jklsd jklfsdf ksdlfj klsdjf l;ksdjf skdfj sdf klsdf klsdf jksd jksdfjklsdf kljsdfjkl sdl;ksdfj l;ksd flsdf sdf sdfjklsdf jklsd jkl</div> <div class="box"> <div id="title">RECENT GAMES</div> fsdf ksdlfj klsdjf l;ksdjf skdfj sdf klsdf klsdf jksd jksdfjklsdf kljsdfjkl sdl;ksdfj l;ksd flsdf sdf sdfjklsdf jklsd jkl</div> </div> </div> Link: http://mushsauce.110mb.com/art.html my problem could best be summed up by looking at this test html : http://hatchetman82.4000webs.com/test.html it contains 2 DIVs, and in IMG inside every DIV. the image is (probably) allined as text, which means there's a small margin between the DIV content area lower border and the IMG border. this space (colored yellow) does not originale from any padding, spacing or margin attribute (or at least tinkering with those didnt help). setting the line-height on the DIVs to 100% helps a bit (shrinks the gap a little), but causes problems with, for instance, a SPAN inside one of those divs. i've also tried all sorts of values for vertical-align on the DIVs to no avail. any help in eliminating the gap would be greatly appreciated. |