CSS - Margins With Aligned Tables
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 Similar TutorialsI'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 Hi, I'm working on this webpage http://www.dkwebconsultants.com/jaclo/subnav.php?SubGroupID=24 and it works fine in Mozilla. However, in IE there is a thin white space between the td that says "handshowers" in it and the blue above as well as the the left side of the page. The same thing for the slightly lighter td below it and the left side of the page. I've been reading and error checking all day, but i can't figure this one out. the php/html code is as follows: Code: <table class="nicetable"> <?php include "header.html" ?> <!-- This is one table row, the table has two td's--> <tr> <td height="410"> <table class="nicesubnavtable"> <tr> <td id="subnavtop"> <script language="JavaScript1.2" type="text/javascript"> <!-- myTest.writeMenuBar(); //--> </script> </td> </tr> <tr> <td id="subnavbottom"> <?php $sql = "SELECT * FROM SubGroup WHERE GroupID = '$GroupID'"; $result = mysql_query($sql) or die (mysql_error()."<br />Couldn't execute query: $sql"); $num_results = mysql_num_rows($result); echo "<br>"; for($i=0; $i < $num_results; $i++){ $row = mysql_fetch_array($result); $tempSubGroupID = $row['SubGroupID']; $tempName = stripslashes($row['Name']); if($SubGroupID == $tempSubGroupID){ echo "<a id='snsgnamesblue' href='subnav.php?SubGroupID=$tempSubGroupID'>$tempName</a>"; } else{ echo "<a id='snsgnames' href='subnav.php?SubGroupID=$tempSubGroupID'>$tempName</a>"; } } ?> </td> </tr> </table> </td> <td id="mainareanav"> <?php $sql1 = "SELECT * FROM IndividualItem WHERE SubGroupID = '$SubGroupID'"; $result1 = mysql_query($sql1) or die (mysql_error()."<br />Couldn't execute query: $sql"); $num_results1 = mysql_num_rows($result1); for($i=0; $i < $num_results1; $i++){ $row = mysql_fetch_array($result1); $tempItemID = $row['ItemID']; $tempNickName = stripslashes($row['NickName']); $filename = stripslashes($row['ThumbImageName']); $filenamearray = explode('.', $filename); $fnameNoExt = $filenamearray[0]; //print the nickname, if no nickname print the itemID if($tempNickName == "") echo "<a id=\"itemnames\" href=\"product.php?itemID=$tempSubGroupID\" onMouseover=\"changeit('pic1','$fnameNoExt');\" onMouseout=\"changeit('pic1','image_off');\">$tempItemID</a> \n"; else echo "<a id=\"itemnames\" href=\"product.php?itemID=$tempSubGroupID\" onMouseover=\"changeit('pic1','$fnameNoExt');\" onMouseout=\"changeit('pic1','image_off');\">$tempNickName</a> \n"; } //<td id="subnavright"> //<img src="images/thumb/blankthumb.jpg" id="thumb" name="pic1"> //</td> ?> </td> </tr> <?php include "footer.html" ?> <!-- This is three table rows, public links, user links, search and contact--> </table> The relevant CSS code is: Code: body { font-family : Arial, Helvetica, sans-serif; font-size: 16px; margin: 0; padding: 0 } .nicetable { border-collapse:collapse; } .nicesubnavtable { border-collapse:collapse; width: 200px; margin: 0px; padding: 0px; border-bottom: 2px solid #BAB6B7; } #subnavbar { vertical-align: top; } #subnavmiddle { background-color: white; width: 220px; height: 410px; vertical-align: top; padding-left: 15px; } #subnavright{ width: 240px; vertical-align: top; border-right: 1px solid #797D7E } #subnavtop{ background-color: #F3D891; height: 60px; width: 185px; border-top: 2px solid #F3D891; border-left: 2px solid #F3D891; } #subnavbottom{ background-color: #FAE1A8; height: 350px; width: 185px; padding-right: 15px; border-left: 2px solid #FAE1A8; vertical-align: top; } I'm using tables for the layout and css for the style. I've tried many variations on table layout and haven't come up with anything. If anyone has any ideas, please let me know. Thanks, dk Hi all 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" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>untitled</title> </head> <body> <table style="margin-bottom: 10px;" cellspacing="0" cellpadding="0"> <tr> <td>asdf</td> </tr> </table> <p style="margin-top: 10px;">asdf</p> </body> </html> Why do the margin-bottom of the table and the margin-top of the p not collapse (only tested in Firefox2)? Why is there 20px between them? I don't understand the world of margins anymore... Is this an exception or a bug or what? Thanks for help, Josh Hi! Could some experienced CSS developer please confirm this: All paddings, and right and left margins, always combine (what I mean is if you have a left object with a 5px right margin and a right object with a 5px left margin, the distance between the two will be 10px). However, bottom & top margins never combine. Is all this true? I am having a problem where I have a <div> that holds my body image, margin: 0 auto; Inside that is my content <div> with margin:15px; but this is visually dropping the background image's margin by 15px. The problem compounds every time I add another margin/padding requirement into the rest of the <div>. Code: html, body { margin:0px; padding:0px; background-image:url(images/interface/background.png); } #body_image { width:935; margin:0 auto; padding:0px; background-image:url(images/interface/body.png); background-repeat:no-repeat; background-position:center; } #container { width:904px; height:750px; margin:15px; } #slug { height:15px; } Code: <div id="body_image"> <div id="container"> <div id="header">Header</div> <div id="nav">Nav</div> <div id="sidebar">Sidebar</div> <div id="content">Content</div> <div id="footer">Footer</div> </div> </div> The extent of my CSS is a few tutorials online and the class I took 10 years ago where the teacher said "Here's CSS, you can't do much more than change your font size and color with it... on to tables!" Thought it'd only be fair to give you a little background. Hi All, This seems to be a bit of a recurring problem for me in a lot of the new CSS designs I'm trying... but it seems that IE interprets both padding and margins differently than how firefox interprets them. Sometimes it seems to do it the same, and other times differently. Take a look at this: http://zeroonedesign.com/beta/newsite/index.html CSS he http://zeroonedesign.com/beta/newsite/style.css Now look at it first in Firefox (the desired effect) and then in IE. IE seems to be incapable of understanding this particular piece of the code Code: #menu {padding-top:140px;text-align:left;padding-left:38px;} #menu ul{margin:0px;} #menu ul li{display:inline;margin-right:10px;padding:5px 7px 5px 7px;color:#fff;} #menu ul li a{color:#fff;font-size:10pt;text-decoration:none;} #menu ul li a:hover{color:#fff;font-size:10pt;border-bottom:3px solid #fff;} #menu ul li a.selected{color:#f88000;font-size:10pt;border-bottom:2px solid #f88000;} Ideas? Help? I know the box model is different for IE than it is for FF but I've tried the box model hack and it doesn't seem to do anything. 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? 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. 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? http://206.169.23.2/index3.htm http://206.169.23.2/style3.css The borders are not aligning correctly. 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! Hi there! About a week ago I posted here about an issue, and I received an immense amount of support, so I figured I'd come back here with anything I ran into! My website, in its current state, can be found here. You'll notice that the right column is stuck below the main content area. This is undesirable. Ideally, that gray box would align with the top of the content area, thus creating a simple 2-column layout. In IE (at least version 7), the gray box is shown BELOW the main content area, but still completely inside the #contentwrap div. In Opera and Firefox, however, the gray box is partially in and partially out of the #contentwrap div. I'm not sure what this is due to, (perhaps something weird in my coding?), but either way I just need to get that column to align with the top of the main content area. My code validated fine (but of course that doesn't make it perfect...), and I have provided the complete code for both the (X)HTML and the CSS below: Code: xhtml <!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" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-type" content="text/html; charset=UTF-8" /> <title>Function T .:. Home</title> <style type="text/css" media="all">@import "css/master.css";</style> </head> <body> <div id="entire-page"> <div id="page-container"> <div id="ghost"></div> <div id="header"></div> <div id="navigation"> <ul id="linkmenu"> <li class="n-home"><a href="#"><span>Home</span></a></li> <li class="n-bio"><a href="#"><span>Bio</span></a></li> <li class="n-media"><a href="#"><span>Media</span></a></li> <li class="n-contact"><a href="#"><span>Contact</span></a></li> <li class="n-reviews"><a href="#"><span>Reviews</span></a></li> <li class="n-tutorials"><a href="#"><span>Tutorials::</span></a></li> <li class="n-charts"><a href="#"><span>Charts::</span></a></li> <li class="n-links"><a href="#"><span>Links</span></a></li> </ul> </div> <div id="contentwrap"> <div id="content"> <h1>New Website Launched!</h1> <h2>10.01.2008</h2> Lorem ipsum debet tritani forensibus et nam, ex solet splendide mea, at cum menandri consetetur conclusionemque. Ocurreret persecuti eum at, intellegat temporibus cu sea. Tale modus mei cu, mucius offendit id mea, id consul urbanitas vis. Ius te alii deseruisse, at mea veri illum perfecto. Per iudico commodo blandit ea, mel eu illum sonet efficiantur, tota delenit splendide at qui.<br/><br/> No vel ridens labores percipitur. Ad eum homero percipitur. Sit stet vero ex. In nec volumus explicari.<br/><br/> Pro puto tempor cu, vix in populo doming legendos, ut has regione suavitate. Nec ea movet omnium assentior, ius solum feugiat no, ut est quem putant mollis. Eu simul suscipiantur has, equidem ornatus ea vel. Cu noluisse placerat nec, nostrum probatus eloquentiam cu sed. Lorem di**** et pri, magna ubique no sed, in solum decore quidam pro.<br/><br/> Ad blandit antiopam pri. Meliore necessitatibus et quo. Qui fabellas torquatos an. Id vel tantas recusabo, ex eos natum simul mentitum. Ea nostrud takimata iudicabit vel. <br/><br/> <h1>This is Only a Test</h1> <h2>10.01.2008</h2> Id sit minimum patrioque ullamcorper, vix prompta intellegat at. Mea vidisse admodum denique in, at eam graecis expetendis referrentur, ancillae prodesset ut eam. Meliore luptatum appellantur duo eu. Cu dicam invenire has, ex affert pertinacia vis, ut impetus mandamus sea. Pri nisl atomorum ex, nam te eripuit numquam docendi. <br/><br/> Est stet albucius maluisset id, et habeo graece molestie mel, adhuc nonumy eloquentiam ea vel. Ubique takimata persequeris ne his, pro an augue feugiat efficiendi, eu eam unum nominavi mediocritatem. Corpora disputando eloquentiam ex quo, cu prima choro salutandi his. Has eirmod regione accumsan eu. Cum ea wisi scripta, veritus assentior complectitur pro ea, mea cu aeterno vocibus eligendi. Ei eam maiorum perfecto. <br/><br/> Et eam eius nostro. In alienum definitiones nec, sed wisi mentitum incorrupte ea, ei per quando appetere. Eu dicta vitae ignota vel. Eu qui quot aperiri adipiscing, eu vim novum deleniti, quod kasd eu has. Copiosae incorrupte neglegentur mea cu, sit adolescens elaboraret constituam te, ea sea tamquam molestie definiebas. Rebum harum labore pro ex, ex soluta contentiones vix, no usu esse nominati mandamus. <br/><br/> Et pro aliquando expetendis theophrastus. Mei ne errem consequat, mei ut sonet singulis indoctum. Alia nihil civibus per ei. Ei sed mucius perfecto elaboraret, invidunt neglegentur ei mel, at vide tota quo. <br/><br/> <h1>New Site Coming Soon!</h1> <h2>09.29.2008</h2> Id placerat phaedrum per. Nec ut persius legimus conceptam, ius no ludus clita consul. At atomorum voluptatum cum, duo cibo putant reprimique ne. Ea mei hinc eros noluisse, ad sea ipsum di****, alii debet tamquam te nam. <br/><br/> Essent labores explicari cu duo. Ius causae copiosae an. Ex omnium diceret maluisset vim. Ad mel vivendo disputationi. Hendrerit democritum id cum, quodsi molestiae duo te. </div> <div id="rightbar"> <h2>THIS IS A TEST</h2> I am trying to see if I can get this column to align to the top of my browser content-wrapper div!<br/><br/> Unfortunately, I can't seem to get it to work!<br/> </div> </div> <div id="content-bottom"></div> <div id="footer"> Home - Bio - Media - Contact - Reviews - Tutorials - Charts - Links <br/> All information Copyright 2008 Tom Winchester unless otherwise specified. All original artists <br/> and labels retain their full respective rights and royalties to all copyrighted material. Mixes are presented <br/> for promotional purposes only. Duplication of any material in part or in whole without the <br/> express written consent of Tom Winchester is strictly prohibited. </div> </div> </div> </body> </html> Code: css html, body { margin: 0px; padding: 0px; background: url(../images/bgpattern.gif); } #entire-page { } #page-container { margin: auto; width: 750px; } #ghost { height: 15px; } #header { height: 110px; background: url(../images/headers/rotator.php); background-repeat: no-repeat; } #navigation { width: 750px; height: 40px; background: url(../images/navigation.gif); background-repeat: no-repeat; } ul#linkmenu, #linkmenu li { padding: 0px; margin: 0px; list-style: none; } ul#linkmenu { float: left; height: 0; } #linkmenu li { font-family: "Times New Roman", Times, Georgia, sans-serif; position: relative; width: 10px; } .n-home { top: 7px; left: 30px; font-size: 22px; } .n-bio { top: -18px; left: 116px; font-size: 22px; } .n-media { top: -43px; left: 179px; font-size: 22px; } .n-contact { top: -70px; left: 271px; font-size: 24px; } .n-reviews { top: -95px; left: 392px; font-size: 22px; } .n-tutorials { top: -120px; left: 485px; font-size: 22px; } .n-charts { top: -145px; left: 592px; font-size: 22px; } .n-links { top: -170px; left: 678px; font-size: 22px; } #linkmenu li a { text-decoration: none; background: none; } #linkmenu li a span { visibility: hidden; } #contentwrap { background-image: url(../images/contentbg.gif); background-repeat: repeat-y; width: 750px; padding-top: 0px; padding-left: 0px; padding-right: 0px; padding-bottom: 0px; } #content { width: 495px; padding-right: 245px; padding-left: 10px; padding-top: 0px; padding-bottom: 0px; font-family: "Trebuchet MS", Verdana, Helvetica, Arial, Times; font-style: normal; font-size: 12px; color: #858585; } #rightbar { float: right; width: 225px; margin-left: 505px; margin-right: 10px; background: gray; text-align: center; font-family: "Trebuchet MS", Verdana, Helvetica, Arial, Times; font-style: normal; font-size: 12px; color: #000000; } #content-bottom { height: 5px; background-image: url(../images/contentbgbottom.gif); background-repeat: no-repeat; } #footer { height: 80px; padding: 5px; text-align: center; font-family: "Trebuchet MS", Verdana, Helvetica, Arial, Times; font-style: normal; font-size: 11px; color: #cfcfcf; } h1 { margin-top: 0px; margin-bottom: 0px; font-family: "Trebuchet MS", Verdana, Helvetica, Arial, Times; font-size: 24px; font-weight: 200; color: #1c2939; } h2 { margin-top: 0px; margin-bottom: 7px; font-family: "Trebuchet MS", Verdana, Helvetica, Arial, Times; font-size: 12px; font-weight: 200; color: #c49271; } THANK YOU!!!! -Tom Winchester- Hi guys, I've trawled the web for this query and have found many solutions, some work, some do not. Some are quite complex, some are fairly simple. I haven't quite found a technique I'm happy with just yet - or that I can get to work properly. Please download the attached .zip and open the index.html in a browser. Basically, that page will show a big main div tag container with 6 smaller divs within it, containing different sized backgound images, with text. I would like the text to be right aligned (which it is)... but also vertically aligned in the middle (and here lies the problem). With table cells it was easy, you aligned items right : middle. Not quite so easy with divs.... grrrrr.... they really shoulda sorted that aspect out ! Nevermind. I've written down the Background pixel heights of the images to save people time - as I suspect the solution may lie with something to do with calculating the heights of the div tags (?) If someone could perhaps jiggle the code and CSS a bit to help create the perfect, working vertically-aligned solution that'd be great - and then paste up either the full HTML code or full CSS code, or both please.... thanks a lot ! Cheers, Andy 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. 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. 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; } 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 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. 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? |