CSS - One Line Justify
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.. Similar TutorialsUsiing ONLY CSS, is it possible to "justify" a block of text and have the last line centered? For example: Code: Fig. 13. Scatter diagram comparing two subspecies of Nyctimene albiventer. One individual of specimens thought to be intergrades is as large as specimens of Nyctimene a. bougainville, whereas the other three intergrades are about the same size as specimens of N. a. minor. CSS seems to only offer one or the other text-align:justify; or text-align:center; Thanks. by default text-align:justify doesnt apply to the last line... how can i make it apply to the last line? You know when you do text sentences on one line then you do the text-align:justify to spread out the whitespace between words to make the sentence fit the maximum length. I was wondering about the image tags instead of the words. Because for some customers, he/she would see one image while some other would see 3 images while some other would see 5 images. I just couldn't figure out how to use even spacing between those images. Is there a way to accomplish that with CSS and div tag? Thanks... edited: What!! 3 days later and no one know the answer. How interesting... Um, look like I'll have to bit the bullet and use the margin-left and margin-right properties in a class for each image. It's the best I can do but it will also be a problem if I have 5 images in a row where image #1 at the left and image #5 at the right would push the web layout wider or overlap something. Hi all, I noticed that when I give the text-align style as "justify", the words are unevenly spaced to justify the alignment. But it looks really weird if there are only two long words in a sentence and many small letter words in the next line. Can any1 suggest a way to align the text inside a <p> to be evenly spaced as well as justified. How to make the text to hyphenate (i.e split words with a '-' and display it in the next line). Is there a CSS property to accomplish this. I wud be grateful to recieve comments. Thanks in Advance. - John Hi there...First post in this forum cause Firefox (and mozilla / netscape) are driving me mad! Please consider the following code: Code: <html> <head> <style type="text/css"> @media print { p {font-size:11px;text-align:justify;} table {width:100%;} } </style> </head> <body> <table width="770" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFCC"> <tr> <td> <p> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nullam molestie, tortor id tempor fringilla, ante massa consequat dui, eget fermentum ante dolor sed felis. Curabitur mollis, velit sit amet lobortis pulvinar, mi lorem condimentum metus, cursus malesuada lectus leo in purus. Suspendisse vehicula, nisl ac varius iaculis, purus felis sodales lorem, in porttitor massa risus a odio. Cras urna felis, sagittis bibendum, ultrices vel, accumsan ac, pede. Maecenas felis nisl, rhoncus non, imperdiet in, tincidunt vitae, ante. Vestibulum cursus, elit non rutrum eleifend, arcu ligula bibendum velit, eget pharetra dui ipsum et tortor. Praesent lectus felis, consectetuer a, varius fringilla, elementum quis, diam. Morbi posuere sem eget odio. Pellentesque imperdiet tellus eget augue. Aliquam et tortor et libero nonummy tristique. Sed feugiat pellentesque sem. In hac habitasse platea dictumst. Vivamus a ipsum eu odio fringilla scelerisque. Ut et neque. Sed fermentum neque nec pede. Morbi enim erat, tempor nec, porttitor eu, tempus ut, nunc. Pellentesque lacinia dapibus urna. Curabitur leo tortor, cursus quis, semper quis, luctus ac, quam. Phasellus sit amet nisl. Nullam molestie nonummy lorem. Etiam consectetuer, ante in lacinia molestie, tellus nisl tincidunt dui, in commodo lectus elit ut elit. In ornare fermentum ante. Nullam felis. Maecenas tempor, lectus vel dignissim tincidunt, metus erat feugiat odio, eu dapibus mauris orci vitae enim. Etiam quis quam vitae risus aliquam iaculis. Ut nunc nulla, hendrerit ut, auctor id, ullamcorper a, risus. Integer fringilla, erat eu interdum imperdiet, lorem purus fermentum wisi, at mattis lectus nisl sit amet ante. Cras dolor. Nunc elementum quam at ligula. Maecenas ut mi ornare neque suscipit vulputate. Praesent ornare. Pellentesque nonummy posuere massa. Morbi sed risus et purus eleifend pulvinar. Proin suscipit ultricies enim. Morbi luctus. Nam quis sem. Quisque mattis. In laoreet velit eu nunc. </p> </td> </tr> </table> </body> </html> This is basically a reconstruction of an existing problem of a far more complex design...in any case, if you try to print->Preview from Opera or IE 5+ everything is sweet...However, Firefox (and the other Gecko browsers) will not properly justify the text when previewing. More precisiely: Firefox will wrap text over 12px correctly yet for small text, the p block will not wrap properly and some text will be cropped. I'm not fussy about justification but even when I removed it I would get the same problem. I'm sure there's a perfectly logical solution to this problem. Maybe the width:100% gets inherited by the td and p but that should not affect the layout...Despite my various experiements of chaging the width and the wrapping properties, I could not solve this. I'm still learning the intricasies of block elements in CSS2 so I would definitely appreciate any help! Thanks in advance, Angelos Hello, In my menu, I'm trying to center the first level of the List Items, and left justify the second level of the List Items. So the Menu will be centered and the pop-up links will be left justified. I know it's probably super simple, but for some reason, I'm missing it! Quote: /*!!!!!!!!!!! Menu Core CSS !!!!!!!!!!!!!*/ .qmmc .qmdivider{display:block;font-size:1px;border-width:0px;border-style:solid;position:relative;z-index:10000;} .qmmc .qmdividery{float:left;width:0px;} .qmmc .qmtitle{display:block;cursor:default;white-space:nowrap;position:relative;z-index:10000;} .qmclear {font-size:1px;height:0px;width:0px;clear:left;line-height:0px;display:block;float:none !important;} .qmmc {position:relative;zoom:1;z-index:10000;} .qmmc a, .qmmc li {float:left;display:block;white-space:nowrap;position:relative;z-index:10000;} .qmmc div a, .qmmc ul a, .qmmc ul li {float:none;} .qmsh div a {float:left;} .qmmc div{visibility:hidden;position:absolute;} .qmmc .qmcbox{cursor:default;display:block;position:relative;z-index:10000;} .qmmc .qmcbox a{display:inline;} .qmmc .qmcbox div{float:none;position:static;visibility:inherit;left:auto;} .qmmc li {z-index:10000;} .qmmc ul {left:-10000px;position:absolute;z-index:10000;} .qmmc, .qmmc ul {list-style:none;padding:0px;margin:0px;} .qmmc li a {float:none} .qmmc li:hover>ul{left:auto;}#qm0 ul {top:100%;}#qm0 ul li:hover>ul{top:0px;left:100%;} 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; } I'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 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, 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? 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... 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 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; } The top image on my site lines up perfectly with the buttons in firefox but is off by a pixle in internet explorer! please help! my site is on digitalplus.webs.com 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 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 Hi, i need to delvelop something like "SomeName X". Currently i am doing with DIV(1 DIV for 'SomeName' and 1 DIV for 'X' and finally float-left to another DIV). Since these names(like "Somename1 X",'Somename2 X"...) are populated in the div container, when it reaches the right end of the container, "X" alone getting wrapped to the next line. But it has to be along with 'SomeName' always. As other forums says, I tried with table but it didn't work since the final div container is fixed and i get multiple names with variant length. I tried clear:both, float left - it too didn't work. I have seen like the one in facebook - compose page. I would like to know how to implement this. Any help appreciated. Thanks in advance. http://www.concrete-creative.com/sharecipe/findfriends.html The dropdown menus don't always show the bottom horizontal line... I see them on all major browsers, but my friend is using an older version of FF and doesn't see the line on the Friend's dropdown (she's using 2.0.0.02 and I'm using 3.0.5). I cannot replicate the bug and I've gone thru all the code and don't understand why it wouldn't show on ONE dropdown, but does on another - with the exact same code. Can anyone see what I might be missing?! The CSS can be viewed he http://www.concrete-creative.com/sharecipe/sharecipe.css (scroll down to /* Navigation */ to see the styles for the menus) THANKS for any input! |