CSS - Right-aligned Full Justified Text?
Sounds weird, but you know us designers are always looking for fresh ways to present content.
I've not actually managed to make this work, even though it seems ridiculously simple; in effect it would just be full justification except any orphaned lines would be right-justified, not left. Any ideas? Similar TutorialsI'd like to be able to grab blocks of text from a plain-text file and present them in a web page, not only preserving the original spaces and line breaks, but also nicely and neatly justifying them (i.e. "full" justification). I tried setting the innerHTML of a div equal to the Ajax'ed responseText, formatted thusly: <div style="blah:blooey; ...;white-spacere-wrap; text-align:justify;">but no joy</div> The pre-wrap worked, but undid the justify. How do I create centered left-justified text? I want it to look something like this: +---------------SUPPOSE THIS IS MY PAGE---------------+ This paragraph is centered with respect to the page, but note that the text is wrapped around and left-justified within the paragraph. +-----------------------------------------------------+ Can I achieve that with CSS without using tables and manipulating cell widths and cell alignments? . hi, i'm wondering whether anyone here knows something that i don't about this... here's some code: Code: <div style="position:absolute; left:30px; top:90px; width:380px; height:80px; border: 3px double #000000; padding:10px; padding-top:5px; line-height:150%"> <table width="380" height="80" border=0 cellspacing=0 cellpadding=0> <tr> <td valign="middle"> <div align="center" style="width:380px;"> <span style="font-size:11px; text-align:left;"> aligned to the left.<BR> but is it centered?<BR> i think not.<BR> </span> </div> </td> </tr> </table> </div> i'm able to achieve vertically centered text in the table cell, and i can center it or align it to the left, but so far in my experimenting i haven't found a way to have text that is aligned to the left, centered in the div. i could always just add a bunch of padding-left on the div so that the text is pushed over and looks nicer although it is not centered, but i'm wondering whether there's a way to do it the way i originally planned to.. thanks very much for looking at this. Wow I REALLY hate CSS. For hours I have been trying to figure this out: Here is some HTML Code: <td> <div class="linksbar"> <div class="linkstext"> link - link - link - link <img src="imagelink.jpg"> <img src="imagelink2.jpg"> </div> </div> </td> [CODE] the CSS [CODE] .linksbar { height: 28px; background-image: url(bg.jpg); } .linkstext { vertical-align: middle; line-height: 28px; font-weight: bold; color: white; } First problem: in Chrome, the text rests at the bottom of the div. I want it in the middle. Second problem: in IE it looks like a mess. The text is sort of in the middle (more towards the bottom). the image links are at the very top. The image link height is like 20 or something. Hi, I am making a site and it is important the text is always positioned over the background image in the same place. I have managed to do this. When I zoom out the text stays in the correct position however when I zoom in (as if I am looking on a smaller screen) the text re positions to the edge of the browser. How can I keep the text in the same position on all monitors? Here is what I have so far (I am very new to css): #content { text-align: left; width: 1060px; padding: 0px 30px 0px 30px; margin-left: auto; margin-right: auto; } Thanks Cameron How to get a text aligned vertically in a css button? Is there any way to make some text vertically aligned inside a DIV? Just like you would do inside a cell? Code: <table><td valign="middle" height="100">This text is vertically aligned</td></table> Apparently, the vertically-align CSS property only works if it is relative to other DIVs. What I want is some vertically aligned text inside a DIV. Thanks for the help. Not sure if this should go in HTML forum or here, but there is CSS involved, so... Anyways, have a page here with 3 images aligned right. (Currently they are floated right, but problem originally was seen with aligned right, changed to css float and problem is the same). http://www.4for4.com/draft_board/to...r_id=HOTSTOVE13 I only see the issue in Chrome, but in Chrome if I refresh the browser, about every third or forth time the text will not wrap around one of the bottom 2 images in the main content area (Hancock & Theron). The text will just lay over the top of the image. If I refresh it will work again, but randomly will not render correctly over one of the two images that is aligned right. Is this just a weird Chrome rendering issue? Or is there some property I can add to the image that will force this to not happen? Thanks a lot. I'm trying to resize links on hover but doing so they change their vertical alignment during hover. Is there a way to prevent this ? Basically I just want the text to be bottom aligned and stay that way on hover. "text-align: top" works, but thats not what I want. simple example: CSS: Code: a:link, a:visited, a:active { font-size: 1em; } a:hover { font-size: 1.5em; } HTML: Code: <div> <a href="#">Text</a> </div> Hi, I wonder if you can help me, In FF, this site has it's rows messed up. If you scroll down towards the bottom the colours become out-of-sync with the text. Can anyone help? (It works fine in IE and Opera) Thanks CSS Code (scroll down): http://jigsaw.w3.org/css-validator/...&usermedium=all Thanks again Hello. I created my own rounded corners fluid site from scratch using CSS and images in the same way you would do it with a table, using the 3x3 format (topleft, topcenter, topright, midleft, midcenter, midright, botleft, botcenter, botright). The problem: The top section works great, but its the middle right section that doesnt justify properly. What you see: For the left and right middle, I have a background repeat on the y-axis. The left background is fine, as well as the middle, but a div inside the middle center is pushing right background to an area below (as shown in this image). http://clients.activemd.net/images/css-problem-screen1.jpg You will notice theres only whitespace on the right, and the background I'm trying to repeat is below it on the right. Heres my CSS: Code: /* CSS Document */ body { margin: 20px auto; /* Had to add margin-top 20px to topleft and top right corners to compensate. */ font-family: Verdana, Geneva, sans-serif; } #main { margin: 20px auto; width: 100%; height: 100%; z-index: 0; } .clear { clear: both; } h1 { margin: 0px 0px 0px 50px; } ul { margin: 0px; padding: 0px; } /* Top Layout */ #top { height: 146px; margin: 0px; padding: 0px; } #top_left { margin-top: 20px; background: url(../images/top-left-bg.png) no-repeat; height: 146px; width: 30px; position: absolute; top: 0px; left: 0px; } #top_right { margin-top: 20px; background: url(../images/top-right-bg.png) no-repeat; height: 146px; width: 30px; position: absolute; top: 0px; right: 0px; } #top_center { margin: 0px 30px; } #top_center_bg { background: url(../images/top-mid-bg.png) repeat-x; width: 100%; height: 30px; } #top_center_bar { background: url(../images/top-mid-bar-bg.png) repeat-x; width: 100%; height: 90px; } /* Middle Layout */ #middle { min-height: 500px; margin: 0px; padding: 0px; } #middle_left { background: url(../images/middle-left-bg.png) repeat-y; height: 100%; width: 30px; position: absolute; left: 0px; } #middle_right { background: url(../images/middle-right-bg.png) repeat-y; height: 100%; width: 30px; position: absolute; right: 0px; } #middle_center { min-height: 100px; } /* Bottom Layout */ #bottom { background: #eee; min-height: 100px; } /* Left box Layout */ #left_box { width: 156px; position: absolute; left: 0px; min-height: 90px; z-index: 100; margin: 0px; padding: 0px; } #left_box_top { background: url(../images/left-box-top.png) no-repeat; width: 156px; height: 30px; position: relative; top: 0px; margin: 0px; padding: 0px; } #left_box_mid { background: url(../images/left-box-mid.png) repeat-y; position: relative; right: 0px; height: 100%; margin: 0px; padding: 0px; } #left_box_bottom { background: url(../images/left-box-bottom.png) no-repeat; width: 156px; height: 30px; position: relative; bottom: 0px; } #left_box_content { color: #FFF; margin-left: 20px; margin-right: 5px; font-size: 0.8em; } #left_box_content a { color: #FFF; } /* Content Area Styling */ #report { height: 100%; min-height: 400px; border: 1px solid #999; margin-left: 160px; margin-right: 30px; } #report_data { float: left; width: 775px; height: 100%; max-height: 400px; overflow: scroll; border: 1px dotted #ccc; margin: 10px; min-height: 100px; } /* Login Info box */ #login_info { background: url(../images/login-bar-bg.png) repeat-x; position: absolute; top: 79px; left: 40px; border: 1px solid #FFF; min-width: 250px; height: 44px; line-height: 44px; color: #FFF; } and here's the HTML of the site. Code: <body> <div id="main"> <div id="top"> <div id="top_left"></div> <div id="top_center"> <div id="top_center_bg"> <div id="login_info">Logged in as: ricktest <a href="http://clients.activemd.net?action=logout">Log Out</a></div> <div id="top_nav"> <ul class="tabContainer"> <li> <a href="#" class="blue"> <span class="left"></span> <span class="mid">Inquiries</span> <span class="right"></span> </a> </li> <li> <a href="#" class="blue">Engage <span class="left"></span> <span class="right"></span> </a> </li> <li> <a href="#" class="blue">Manage <span class="left"></span> <span class="right"></span> </a> </li> </ul> </div> <div id="sub_nav"><a href="javascript:getdata('#middle_center', 'main/index.php');">Home</a> | <a href="javascript:getdata('#middle_center', 'forms/index.php');">Forms</a> </div> </div> <div class="clear"></div><div id="top_center_bar"></div></div> <div id="top_right"></div> </div> <div class="clear"></div> <div id="middle"><!--Here begins the first layer of dynamic content --> <div id="middle_left"></div> <div id="middle_center"></div> <div id="middle_right"></div> </div><!--Here ends the first layer of dynamic content --> <div class="clear"></div> <div id="bottom"> <div id="bottom_left"></div> <div id="bottom_center">Bottom</div> <div id="bottom_right"></div> </div> </div> </body> The site is dynamic PHP, so I cant just throw a link in here. I hope this is enough information. If anyone can help me with this, I would appreciate it. Thanks. Rick Hi all, Not sure if I'm aligning the container of this page properly: http://ntcjapan.com/languages/arabic/ The page is right-aligned and displaying correctly on all browsers except I.E. 5.0 On IE 5.0, the container remains on the left of your screen, not on the right. Due to arabic text, etc., the direction of the body is rtl The CSS (note the "container" div at the end, plus its margin): Code: body { height:100%; margin: 0px; padding: 0; background: #FFFFFF url(../../../images/0_bg_body.jpg) no-repeat fixed -5px 100px; } body { font-family: "Simplified Arabic", "Arabic Transparent", "Traditional Arabic", "Arial (Arabic)", "Times New Roman (Arabic)", "AGA Arabesque", "NaskhTT", "Akhbar MT", "Courir New (Arabic)", "Decotype Naskh", "Mudir MT", "Simplified Arabic fixed", "Tahoma (Arabic)", "Andalus", "Monotype Koufi", "Decotype Naskh Extension", "Decotype Naskh Special", "Decotype Naskh Swashed", "Decotype Naskh Variants", "Decotype Naskh Thuluth", "Simplified Arabic backslanted", "Traditional Arabic Backslanted", Arial,Helvetica,sans-serif; line-height:19px; font-size: 13pt; font-weight:bold; } p { direction:rtl; } div { text-align:right; direction:rtl; } #container { margin: 0 0 0 auto; text-align: left; width: 762px; background: url(../images/0_bg_right.gif) repeat-y fixed top right; min-height: 100%; height: auto; direction: ltr; } I suppose I need an additional style for IE 5.0 and 5.5 - to tell those browsers to align the container to the right. Any ideas? Thanks in advance! I've had this problem before but figured I'd finally write for suggestions. When tables that are aligned to a certain position of text, say to the right of the text, have style="margin-left: 10px" to avoid running right into the text, in I.E. that margin gets applied to the first line of the text as well. Easier to show: http://wandp.american.edu/community_events.php Notice the indentation in the text in IE that isn't in Firefox. I think what I did as a workaround before is give the table a white left border, or make an extra table column. Would like to avoid either (the border part because I might decide to change the background colo or use this in several apps). Any thoughts? Thanks, Jeremy http://206.169.23.2/index3.htm http://206.169.23.2/style3.css The borders are not aligning correctly. I've had this problem before but figured I'd finally write for suggestions. When tables that are aligned to a certain position of text, say to the right of the text, have style="margin-left: 10px" to avoid running right into the text, in I.E. that margin gets applied to the first line of the text as well. Easier to show: http://wandp.american.edu/community_events.php Notice the indentation in the text in IE that isn't in Firefox. I think what I did as a workaround before is give the table a white left border, or make an extra table column. Would like to avoid either (the border part because I might decide to change the background color or use this in several apps). Any thoughts? Thanks, Jeremy Hi everybody, I'm sure there is a very simple solution to this layout problem but I haven't been able to fix it. My design displays perfectly in Firefox but is out of place by 40px in IE. URL The CSS in question is certainly this div: Code: #sub-content ul li a { ... margin-left: -40px; position: relative; } I've tried various IE hacks, such as the ones mentioned on Centricle, e.g: Code: div>#sub-content ul li a { margin-left:0px; } But to no avail. Would a CSS guru mind helping me out? Hi, i'm working on this search box but I can't get the 3 elements perfectly aligned, the bottom of the elements should be aligned. What I have is: Search: <input> <img> Search is <label>, input is a normal input text box, <img> is used instead of submit. The problem is, that the <img> is about 5px higer than the other two. The Search label and input are middle aligned. Does anyone have a solution for this positioning problem? A link with workarounds would be useful. Thanx. I've been trying to tweak the styling on hxxp://beecycle-co-uk.domain-ref.http.xenon.lon.periodicnetwork.com/Products.aspx?category=2&product=8 for a while now, and for some reason that page's #wrappper is aligned left, not center. I've picked through each element but I can't see any reason for it to do that. Am I missing something? I'm currently creating a simple website using css and its looks fine in IE however the nav bar is not aligned with everything else in Firefox. Sorry i'm new at CSS, thanks for the help in advance. Here is the site: insightchirocare.ca Here is the css code: Code: /* CSS Document */ *{ padding:0; margin:0; width: auto; } body { font-family:Verdana, Arial, Helvetica, sans-serif; background-repeat:repeat-x; background-color:#ffffff; padding:0; margin:0; } #container { width:800px; margin:auto; padding-top: 30px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; } /* HEADER IMAGE */ #header{ background-repeat:no-repeat; background-image: url(images/header.gif); height: 150px; width: 800px; float:left; margin:300 px; padding-top: 0px; padding-right: 0px; padding-bottom: 3px; padding-left: 0px; } /* HEADER BACKGROUND IMAGE END */ /* NAVIGATION */ #nav{ width:800px; float:right; height:30px; margin-top: 0px; margin-left: 0px; margin-bottom: 0px; margin-right: 40px; padding-top: 0px; padding-right: 0px; padding-bottom: 3px; padding-left: 0px; } .menu ul{ padding:0; margin:0; list-style-type:none; list-style:none; display:inline; } .menu li{ padding-right:0px; margin:0 0px 0 0; height:30px; list-style-type:none; list-style:none; display:inline; float:left; } span{ display:none; } #home a{ background:url(images/nav_bar/home.gif); width:74px; height:30px; display:block; } #home a:hover { background:url(images/nav_bar/home_gr.gif); width:74px; height:30px; display:block; } #home a:active { background:url(images/nav_bar/home_gr.gif); width:74px; height:30px; display:block; } #about_us a{ background:url(images/nav_bar/about_us.gif); width:82px; height:30px; display:block; } #about_us a:hover{ background:url(images/nav_bar/about_us_gr.gif); width:82px; height:30px; display:block; } #about_us a:active{ background:url(images/nav_bar/about_us_gr.gif); width:82px; height:30px; display:block; } #first_visit a{ background:url(images/nav_bar/first_visit.gif); width:81px; height:30px; display:block; } #first_visit a:hover{ background:url(images/nav_bar/first_visit_gr.gif); width:81px; height:30px; display:block; } #first_visit a:active{ background:url(images/nav_bar/first_visit_gr.gif); width:81px; height:30px; display:block; } #gonstead_chiro a{ background:url(images/nav_bar/gonstead_chiro.gif); width:162px; height:30px; display:block; } #gonstead_chiro a:hover{ background:url(images/nav_bar/gonstead_chiro_gr.gif); width:162px; height:30px; display:block; } #gonstead_chiro a:active{ background:url(images/nav_bar/gonstead_chiro_gr.gif); width:162px; height:30px; display:block; } #faq a{ background:url(images/nav_bar/faq.gif); width:71px; height:30px; display:block; } #faq a:hover{ background:url(images/nav_bar/faq_gr.gif); width:71px; height:30px; display:block; } #faq a:active{ background:url(images/nav_bar/faq_gr.gif); width:71px; height:30px; display:block; } #kid_chiro a{ background:url(images/nav_bar/kids_chiro.gif); width:124px; height:30px; display:block; } #kid_chiro a:hover{ background:url(images/nav_bar/kids_chiro_gr.gif); width:124px; height:30px; display:block; } #kid_chiro a:active{ background:url(images/nav_bar/kids_chiro_gr.gif); width:124px; height:30px; display:block; } #testimonials a{ background:url(images/nav_bar/testimonials.gif); width:105px; height:30px; display:block; } #testimonials a:hover{ background:url(images/nav_bar/testimonials_gr.gif); width:105px; height:30px; display:block; } #testimonials a:active{ background:url(images/nav_bar/testimonials_gr.gif); width:105px; height:30px; display:block; } #contact_us a{ background:url(images/nav_bar/contact_us.gif); width:101px; height:30px; display:block; } #contact_us a:hover{ background:url(images/nav_bar/contact_us_gr.gif); width:101px; height:30px; display:block; } #contact_us a:active{ background:url(images/nav_bar/contact_us_gr.gif); width:101px; height:30px; display:block; } /* NAVIGATION END*/ /* LEFT_CONTENT*/ #left_content { height: 450px; width: 500px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #757171; margin-top: 0px; margin-left: 0px; float: left; margin-right: 5px; background-color:ffffff; } /* LEFT_CONTENT END*/ /* REG_CONTENT*/ #reg_content { height: auto; width: 800px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #757171; margin-top: 0px; margin-left: 0px; background-color:#ffffff; } /* REG_CONTENT END*/ /* RIGHT_CONTNET*/ #right_content{ height: 450px; width: auto; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #757171; padding: 0; margin-top: 0px; margin-left: 0px; margin-bottom: 0px; margin-right: 0px; background-color:#e3e3e3; } /* RIGHT_CONTENT END*/ h1 { padding:0; margin:0; font-size:16px; color:#008bcf; font-family: Verdana; font-weight: normal; } h2 { padding:0; margin:0; font-size:12px; color:#008bcf; font-family: Verdana; font-weight: normal; } p { padding:0; margin:0; font-size:12px; color:#757171; font-family: Verdana; } /* FOOTER*/ #footer { padding : 0; width: 800px; height: 40px; background: url(images/footer.gif); margin-top: 2px; margin-right: auto; margin-bottom: 30px; margin-left: auto; } /* FOOTER END*/ .clearfloats {clear:both;} A:link { text-decoration: underline; color: #008BCF; } A:visited { text-decoration: underline; color: #008BCF; } A:active { text-decoration: underline; color: #18fa07; } A:hover { text-decoration: underline; color: #18fa07; } |