CSS - Div Position - 400px To The Right Of Center? Help!
Is there a way to position something on the page, absolute or fixed at 400px from the center? Can't seem to find a solution on google, but maybe I'm looking for the wrong thing??? help!
Similar TutorialsHello; i am trying to put a content of my page sit in the center of the my page it doesn't matter what browser is. but i just can do it for firefox, netscap and Opera browser, but i could not do it for IE browser. In the IE browser, my content of the page sit in the left side of the page. My IE file vision is 7.0.6 Could anyone help, thanks. my code as following: Code: <html> <head> <style type="text/css"> #container{ position: relative; width: 586px; /* width + border for IE 5.x */ w\idth: 580px; /* real width */ border: solid #036; border-width: 0 3px; margin: auto; } </style> </head> <body> <div id="container"> <p>Skip navigation</p> <ul> <li><a href="">Home</a></li><li><a href="">About</a></li><li><a href="">Contact Us</a></li><li><a href="">Site map</a></li> </ul> The Origin After getting back from his jaunt, Charles started work on his theory of evolution. Distracted by games of Reversi, Freecell and Solitaire on his computer, he took quite a while but then he heard that some Australian bloke named Wallace had come up with a similar idea so he got a move on to prevent his thunder being stolen. In 1858 Darwin and Wallance presented a joint paper to the Linnean Society of London that sent rumbles across the establishment and really quite upset a lot of people. The next year saw the publication of Darwin's 500-page 'abstract' - 'On The Origin of Species by Means of Natural Selection or the Preservation of Favoured Races In The Struggle For Life' (or OTOOSBMONSOTPOFRITSFL for short). </div> </body> </html> I'm trying to position the image below vertically center and horizontally left to no avail. Its horizontally left but centers the top of the image in the center of the page. What am I doing wrong? <DIV style="position: absolute; top: 50%; left: 0px; border: none"><img src="images/right.jpg"></img></DIV> I have having issues with IE displaying my page wrong. The page is http://]http://tampabay-online.org/cetr/about.php (or any page within that site) and the css can be found at http://tampabay-online.org/cetr/cetr.css It displays fine in Firefox and Opera but IE makes the content class lower from the top than the #right navigation bar (they should both be 20 pixels form the top) Any help much appreciated. Code: .content { position:relative; width:320px; margin-left: 125px; margin-top: 20px; border:1px solid black; background-color:white; padding:10px; z-index:3; } #right { position:absolute; width:200px; top:20px; left:500px; border:1px solid black; background-color:white; padding:10px; z-index:1; } I am using the following code how do I change it so that it would show up in the center of the brower window? Thanks Tim PHP Code: <div style="position: absolute; left: 0px; z-index: 1; top: 0px; align: center\"> <object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0 ,0\" width=\"544\" height=\"396\" id=\"cardio\" align=\"middle\"> <param name=\"allowScriptAccess\" value=\"sameDomain\" /> <param name=\"movie\" value=\"ads/cardio3.swf\" /> <param name=\"loop\" value=\"false\" /> <param name=\"quality\" value=\"high\" /> <param name=\"wmode\" value=\"transparent\" /> <param name=\"bgcolor\" value=\"#ffffff\" /> <embed src=\"ads/cardio3.swf\" loop=\"false\" quality=\"high\" wmode=\"transparent\" bgcolor=\"#ffffff\" width=\"544\" height=\"396\" name=\"cardio\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /> </object> </div> I'm not quite sure how to do this: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> #content { float: left; width: 437px; margin: 10px; margin-top: 0; } /* end #content */ #content ul { list-style-type: none; margin-top: auto; padding-bottom: 1em; background-color: #00ff00; } /* end #content ul */ #content ul li { float: left; } /* end #content ul li */ #content ul li a { position: relative; left: 1px; top: 1px; text-decoration: none; color: #ff0000; } /* end #content ul li a */ #content p { clear: both; } .shadow { color: blue; position: absolute; left: -1px; top: -1px; } /* end .shadow */ </style> </head> <body> <div id="content"> <ul> <li><a href="#">Link 1<span class="shadow">Link 1</span></a></li> <li><a href="#">Link 2<span class="shadow">Link 2</span></a></li> <li><a href="#">Link 3<span class="shadow">Link 3</span></a></li> <li><a href="#">Link 4<span class="shadow">Link 4</span></a></li> </ul> </div> </body> </html> I need the text to be centered in the green box. Not sure the best way to do that. Hello, I have a container div and i want to put some fixed-width left-floated divs inside it. The problem is i want to make them appear in the center of the container, instead of left. The problem is i don't know how many of them there's going to be, therefore i can't just put them inside of another fixed-width container and set it's margin to auto. I could probably do it with tables easily, but how would i do it in css? Hi all, I've got a table here and can't seem to get text-align:center in the cells that have colspan='2' (f1s, f2s...) as an attribute. HTML Code: Original - HTML Code <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Game</title> <style type='text/css'> table { border: 1px solid black; } tr.top { font-size:10px; } tr.tall { height:50px; } td { width:20px; border: 1px solid black; text-align:center; } td.name { font-size:18px; width:100px; height:50px; } td.finalscore { color:red; font-size:18px; width:40px; } </style> </head> <body> <table cellpadding=0 cellspacing=0> <tr class='top'> <td rowspan='2' colspan='2' class='name'>Name </td> <td> f1a </td> <td> f1b </td> <td> f2a </td> <td> f2b </td> <td> f3a </td> <td> f3b </td> <td> f4a </td> <td> f4b </td> <td> f5a </td> <td> f5b </td> <td> f6a </td> <td> f6b </td> <td> f7a </td> <td> f7b </td> <td> f8a </td> <td> f8b </td> <td> f9a </td> <td> f9b </td> <td> f10a </td> <td> f10b </td> <td> f10c </td> <td style="background-color:black"> </td> </tr> <tr class='tall'> <td colspan='2'>f1s</td> <td colspan='2'>f2s</td> <td colspan='2'>f3s</td> <td colspan='2'>f4s</td> <td colspan='2'>f5s</td> <td colspan='2'>f6s</td> <td colspan='2'>f7s</td> <td colspan='2'>f8s</td> <td colspan='2'>f9s</td> <td colspan='2'>f10s</td> <td colspan='2'>Score</td> </tr> </table> </body> </html> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Game</title> <style type='text/css'> table { border: 1px solid black; } tr.top { font-size:10px; } tr.tall { height:50px; } td { width:20px; border: 1px solid black; text-align:center; } td.name { font-size:18px; width:100px; height:50px; } td.finalscore { color:red; font-size:18px; width:40px; } </style> </head> <body> <table cellpadding=0 cellspacing=0> <tr class='top'> <td rowspan='2' colspan='2' class='name'>Name </td> <td> f1a </td> <td> f1b </td> <td> f2a </td> <td> f2b </td> <td> f3a </td> <td> f3b </td> <td> f4a </td> <td> f4b </td> <td> f5a </td> <td> f5b </td> <td> f6a </td> <td> f6b </td> <td> f7a </td> <td> f7b </td> <td> f8a </td> <td> f8b </td> <td> f9a </td> <td> f9b </td> <td> f10a </td> <td> f10b </td> <td> f10c </td> <td style="background-color:black"> </td> </tr> <tr class='tall'> <td colspan='2'>f1s</td> <td colspan='2'>f2s</td> <td colspan='2'>f3s</td> <td colspan='2'>f4s</td> <td colspan='2'>f5s</td> <td colspan='2'>f6s</td> <td colspan='2'>f7s</td> <td colspan='2'>f8s</td> <td colspan='2'>f9s</td> <td colspan='2'>f10s</td> <td colspan='2'>Score</td> </tr> </table> </body> </html> Any pointers? I need to center an img that I have fade in how do i change the below code so that it centers in the page STYLE=\"POSITION: absolute; HEIGHT:75%;WIDTH:75%;TOP:5;LEFT:0;VISIBILITY:VISIBLE; ZINDEX:1\" thanks tim I have a div that I am using as a pop up layer. I just set the visible attribute on mouseover and mouseout. I want to have that dic pop up in the center of the screen vertically and horizontally. I have not had much luck with other examples but this is what I have: Div Code: <div class="popbox" id="1" onMouseover="showpop('1');" onMouseout="hidepop('1');"> <p class="popboxheader">HEADER</p> <p class="popboxcontent"> <table> <tr> <td class="popboxcontentleft" valign="top"><p>some content here</p></td> <td class="popboxcontentright" valign="top"><p>more content</p></td> </tr> </table> </p> </div> CSS Code: div.popbox { text-align: left; background-color:#ffffff; border: 1px solid black; padding: 5px; width: 570px; visibility: hidden; margin:0 auto; } .popboxheader { padding: 5px; color: white; letter-spacing: 2pt; background-color: #003399; font-family: Verdana, san-serif; font-size:16px; color:#ffffff; color:#ffffff; font-weight:bold; text-align:left; } .popboxcontent { font-size: 10pt; font-weight: normal; text-align: left; font-family: Verdana, san-serif; color:#4074b7; color:#0349A3; } .popboxright { font-size: 9pt; font-weight: normal; text-align: left; width:200px; font-family: Verdana, san-serif; color:#4074b7; color:#0349A3; } Script Code: function showpopp(cid){ var obj = document.getElementById(cid); obj.style.visibility = "visible"; } function hidepop(cid){ var obj = document.getElementById(cid); obj.style.visibility = "hidden"; } I am not sure, but I am writingthe div at the end of the content that is always shown on the screen, just for some info. Any help is appreciated. I'm strugling with this code. The homepage is http://thebeadingsite.com and I can't get this to line up properly. Here's my code, any suggestions?? Code: <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>The Beading Site</title> <style type='text/css'> body { background-color: black; } #bg-right { background-color: white; position: absolute; top: 0; bottom: 0; left: 50%; right: 0; z-index: -1; } #content { position: relative; top: 0; bottom: 0; left: 25%; right: 0; z-index: 0; } </style> </head> <body> <div id="bg-right"></div> <div id="content"><table id="Table_01" width="800" height="601" border="0" cellpadding="0" cellspacing="0"> <tr> <td colspan="5"> <img src="images/bnt-site-final_01.jpg" width="800" height="158" alt=""></td> </tr> <tr> <td colspan="2" rowspan="2"> <img src="images/bnt-site-final_02.jpg" width="623" height="421" alt=""></td> <td><a href="http://www.etsy.com/shop/mixaleena" target="_blank"> <img src="images/bnt-site-final_03.jpg" width="72" height="38" border="0" alt="Click here to order online at Etsy!"></a></td> <td colspan="2" rowspan="2"> <img src="images/bnt-site-final_04.jpg" width="105" height="421" alt=""></td> </tr> <tr> <td> <img src="images/bnt-site-final_05.jpg" width="72" height="383" alt=""></td> </tr> <tr> <td> <img src="images/bnt-site-final_06.jpg" width="526" height="21" alt=""></td> <td colspan="3"> <a href="mailto:mixaleena@thebeadingsite.com?subject=Comments from the front page"> <img src="images/bnt-site-final_07.jpg" width="247" height="21" alt="" border="0"></a></td> <td> <img src="images/bnt-site-final_08.jpg" width="27" height="21" alt=""></td> </tr> <tr> <td> <img src="images/spacer.gif" width="526" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="97" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="72" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="78" height="1" alt=""></td> <td> <img src="images/spacer.gif" width="27" height="1" alt=""></td> </tr> </table> </div> </body> </html> I am having a small problem with centering a main container div.. The main div is 700 pixels wide .. I have numerous divs inside this container div. Everything is peachy, but I cant seem for the life of me to get the container div centered in the browser window... I tried <div align="center"> even tried text-align:center; any thoughts? Hello again CSS experts! I know this question gets asked a lot but I have had a search on here and google and can't seem to get it working for me. My page has a sidebar div which contains a UL menu (SpryMenuBar from Dreamweaver) I would like to center the menu within the div. I have tried putting it within a child div and playing with auto margins and left 50%, etc. but no joy. If anyone could point out what I'm doing wrong I'd would be very grateful. Another small issue (which I suspect is related) is the <p> in between the two menus wraps around the right of the first menu when viewed in IE. Jez index.php: 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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Mseis</title> <link href="includes/layout.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="container"> <div id="header"> <?php include("includes/header.php"); ?> <!-- end #header --></div> <div id="sidebar1"> <?php include("includes/menu.php"); ?> <!-- end #sidebar1 --> </div> <div id="mainContent"> <div id="navbar"> <a href="index.php">Home</a> <!-- end #navbar --></div> <div id="pageContent"> <h1> Main Content </h1> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam, justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo porttitor, felis. Nam blandit quam ut lacus. Quisque ornare risus quis ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at, odio. Donec et ipsum et sapien vehicula nonummy. Suspendisse potenti. Fusce varius urna id quam. Sed neque mi, varius eget, tincidunt nec, suscipit id, libero. In eget purus. Vestibulum ut nisl. Donec eu mi sed turpis feugiat feugiat. Integer turpis arcu, pellentesque eget, cursus et, fermentum ut, sapien. Fusce metus mi, eleifend sollicitudin, molestie id, varius et, nibh. Donec nec libero.</p> <h2>H2 level heading </h2> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam, justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo porttitor, felis. Nam blandit quam ut lacus. Quisque ornare risus quis ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at, odio.</p> <h3>H3 level heading </h3> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam, justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo porttitor, felis. Nam blandit quam ut lacus. Quisque ornare risus quis ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at, odio.</p> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam, justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo porttitor, felis. Nam blandit quam ut lacus. Quisque ornare risus quis ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at, odio.</p> <!-- end #pageContent --></div> <!-- end #mainContent --></div> <!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats --> <br class="clearfloat" /> <div id="footer"> <?php include("includes/footer.php"); ?> <!-- end #footer --></div> <!-- end #container --></div> </body> </html> menu.php: Code: <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script> <link href="SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css" /> <div class="menu"> <p> <ul id="RootMenu" class="MenuBarVertical"> <li><a href="index.php">Home</a></li> <li><a href="about.php">About Us</a></li> <li><a href="#" class="MenuBarItemSubmenu">Services</a> <ul> <li><a href="#">Passive Acoustic Monitoring</a></li> <li><a href="#">Training</a></li> </ul> </li> <li><a href="#" class="MenuBarItemSubmenu">Personnel</a> <ul> <li><a href="#">Mseis</a></li> <li><a href="#">3rd Party</a></li> </ul> </li> <li><a href="#">Contact Us</a></li> </ul> </p> <p> The menu should be centered like this text, but looks odd in IE </p> <p> <ul id="StaffMenu" class="MenuBarVertical"> <li><a href="webmail.php">Webmail</a> </li> <?php if (strpos($_SESSION["permissions"], "upload") !== false) { echo "<li><a href=\"resources.php\" class=\"MenuBarItemSubmenu\">Operator Resources</a> <ul> <li><a href=\"upload.php\">Upload A File</a></li> <li><a href=\"uploads.php\">View Uploaded Files</a></li> </ul></li>"; } else { echo "<li><a href=\"resources.php\">Operator Resources</a></li>"; } ?> <li><a href="client.php">Client Resources</a></li> <?php if ($_SESSION['loggedin'] == true) { echo "<li><a href='logout.php'>Logout</a></li>"; } ?> </ul> </p> </div> <script type="text/javascript"> <!-- var MenuBar1 = new Spry.Widget.MenuBar("RootMenu", {imgRight:"SpryAssets/SpryMenuBarRightHover.gif"}); var MenuBar2 = new Spry.Widget.MenuBar("StaffMenu", {imgRight:"SpryAssets/SpryMenuBarRightHover.gif"}); //--> </script> layout.css: Code: @charset "utf-8"; @import url("reset.css"); html, body { font: 100% Verdana, Arial, Helvetica, sans-serif; background-color: #666666; margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */ padding: 0; text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */ color: #633C91; } #container { width: 80%; /* this will create a container 80% of the browser width */ background-color: #FFFFFF; margin: 1px auto; /* the auto margins (in conjunction with a width) center the page */ border: 1px solid #000000; text-align: left; /* this overrides the text-align: center on the body element. */ min-width: 800px; } #header { margin: 0; background-color: #DDDDDD; padding: 5px 20px; } #header img { vertical-align: middle; } /* Tips for sidebar1: 1. Since we are working in relative units, it's best not to use padding on the sidebar. It will be added to the overall width for standards compliant browsers creating an unknown actual width. 2. Since em units are used for the sidebar value, be aware that its width will vary with different default text sizes. 3. Space between the side of the div and the elements within it can be created by placing a left and right margin on those elements as seen in the ".twoColHybLtHdr #sidebar1 p" rule. */ #sidebar1 { float: left; width: 15%; /* since this element is floated, a width must be given */ background-color: #EBEBEB; /* the background color will be displayed for the length of the content in the column, but no further */ padding: 0; /* top and bottom padding create visual space within this div */ margin: 0; text-align: center; } #menu { margin: 0 auto; } /* Tips for mainContent: 1. The space between the mainContent and sidebar1 is created with the left margin on the mainContent div. No matter how much content the sidebar1 div contains, the column space will remain. You can remove this left margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends. 2. Be aware it is possible to cause float drop (the dropping of the non-floated mainContent area below the sidebar) if an element wider than it can contain is placed within the mainContent div. WIth a hybrid layout (percentage-based overall width with em-based sidebar), it may not be possible to calculate the exact width available. If the user's text size is larger than average, you will have a wider sidebar div and thus, less room in the mainContent div. You should be aware of this limitation - especially if the client is adding content with Contribute. 3. In the Internet Explorer Conditional Comment below, the zoom property is used to give the mainContent "hasLayout." This may help avoid several IE-specific bugs. */ #mainContent { margin: 0; /* the right margin can be given in percentages or pixels. It creates the space down the right side of the page. */ padding: 0; width: 85%; float: left; } #pageContent { margin: 0; padding: 10px; } #navbar { background-color: #AAAAAA; margin: 0; padding: 1px 10px; } #navbar, #navbar a { color:#FF0000; font-size: small; } #navbar a:link, #navbar a:visited { text-decoration:none; } #navbar a:hover, #navbar a:active { text-decoration:underline; } #footer { padding: 10px; /* this padding matches the left alignment of the elements in the divs that appear above it. */ background:#DDDDDD; } #footer p { margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */ padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */ } /* Miscellaneous classes for reuse */ .fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */ float: right; margin-left: 8px; } .fltlft { /* this class can be used to float an element left in your page */ float: left; margin-right: 8px; } .clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */ clear: both; height: 0; font-size: 1px; line-height: 0px; } /* Custom CSS */ .msgreen { color: #BEDA57; } .msblue { color: #81C4E2; } .mspurple { color: #633C91; } .failed { color: #FF0000; } h1 { color: #BEDA57; font-size: 150%; font-weight: bolder; margin-top: 5px; margin-bottom: 5px; } h2 { color: #81C4E2; font-size: 140%; font-weight: bold; margin-top: 3px; margin-bottom: 3px; } h3 { color: #633C91; font-size: 140%; margin-top: 2px; margin-bottom: 2px; } p { margin-top: 10px; margin-bottom: 10px; } small { font-size: 60%; } fieldset { margin: 1.5em 0 0 0; padding: 0; background-color: #81C4E2; } legend { margin-left: 1em; color: #633C91; font-weight: bold; } fieldset ol { padding: 1em 1em 0 1em; list-style: none; } fieldset li { padding-bottom: 1em; } fieldset.submit { border-style: none; background-color: transparent; } label { display: block; color: #633C91; } input.btn { border: 1px solid; background-color: #81C4E2; color: #633C91; font: bold 80%; } input.btnhov{ border-color: #FF0000; } SpryMenuBarVertical.css Code: @charset "UTF-8"; /* SpryMenuBarVertical.css - version 0.6 - Spry Pre-Release 1.6.1 */ /* Copyright (c) 2006. Adobe Systems Incorporated. All rights reserved. */ /******************************************************************************* LAYOUT INFORMATION: describes box model, positioning, z-order *******************************************************************************/ /* The outermost container of the Menu Bar, a fixed width box with no margin or padding */ ul.MenuBarVertical { margin: 0; padding: 0; list-style-type: none; font-size: 100%; cursor: default; width: 8em; } /* Set the active Menu Bar with this class, currently setting z-index to accomodate IE rendering bug: http://therealcrisp.xs4all.nl/meuk/IE-zindexbug.html */ ul.MenuBarActive { z-index: 1000; } /* Menu item containers, position children relative to this container and are same fixed width as parent */ ul.MenuBarVertical li { margin: 0; padding: 0; list-style-type: none; font-size: 100%; position: relative; text-align: left; cursor: pointer; width: 8em; } /* Submenus should appear slightly overlapping to the right (95%) and up (-5%) with a higher z-index, but they are initially off the left side of the screen (-1000em) */ ul.MenuBarVertical ul { margin: -5% 0 0 95%; padding: 0; list-style-type: none; font-size: 100%; position: absolute; z-index: 1020; cursor: default; width: 8.2em; left: -1000em; top: 0; } /* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to 0 so it comes onto the screen */ ul.MenuBarVertical ul.MenuBarSubmenuVisible { left: 0; } /* Menu item containers are same fixed width as parent */ ul.MenuBarVertical ul li { width: 8.2em; } /******************************************************************************* DESIGN INFORMATION: describes color scheme, borders, fonts *******************************************************************************/ /* Outermost menu container has borders on all sides */ ul.MenuBarVertical { border: 1px solid #CCC; } /* Submenu containers have borders on all sides */ ul.MenuBarVertical ul { border: 1px solid #CCC; } /* Menu items are a light gray block with padding and no text decoration */ ul.MenuBarVertical a { display: block; cursor: pointer; background-color: #EEE; padding: 0.5em 0.75em; color: #333; text-decoration: none; } /* Menu items that have mouse over or focus have a blue background and white text */ ul.MenuBarVertical a:hover, ul.MenuBarVertical a:focus { background-color: #33C; color: #FFF; } /* Menu items that are open with submenus are set to MenuBarItemHover with a blue background and white text */ ul.MenuBarVertical a.MenuBarItemHover, ul.MenuBarVertical a.MenuBarItemSubmenuHover, ul.MenuBarVertical a.MenuBarSubmenuVisible { background-color: #33C; color: #FFF; } /******************************************************************************* SUBMENU INDICATION: styles if there is a submenu under a given menu item *******************************************************************************/ /* Menu items that have a submenu have the class designation MenuBarItemSubmenu and are set to use a background image positioned on the far left (95%) and centered vertically (50%) */ ul.MenuBarVertical a.MenuBarItemSubmenu { background-image: url(SpryMenuBarRight.gif); background-repeat: no-repeat; background-position: 95% 50%; } /* Menu items that are open with submenus have the class designation MenuBarItemSubmenuHover and are set to use a "hover" background image positioned on the far left (95%) and centered vertically (50%) */ ul.MenuBarVertical a.MenuBarItemSubmenuHover { background-image: url(SpryMenuBarRightHover.gif); background-repeat: no-repeat; background-position: 95% 50%; } /******************************************************************************* BROWSER HACKS: the hacks below should not be changed unless you are an expert *******************************************************************************/ /* HACK FOR IE: to make sure the sub menus show above form controls, we underlay each submenu with an iframe */ ul.MenuBarVertical iframe { position: absolute; z-index: 1010; filter:alpha(opacity:0.1); } /* HACK FOR IE: to stabilize appearance of menu items; the slash in float is to keep IE 5.0 from parsing */ @media screen, projection { ul.MenuBarVertical li.MenuBarItemIE { display: inline; f\loat: left; background: #FFF; } } reset.css Code: @charset "utf-8"; /* CSS Document */ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { margin: 0; padding: 0; border: 0; outline: 0; font-weight: inherit; font-style: inherit; font-size: 100%; font-family: inherit; vertical-align: baseline; } /* remember to define focus styles! */ :focus { outline: 0; } body { line-height: 1; color: black; background: white; } ol, ul { list-style: none; } /* tables still need 'cellspacing="0"' in the markup */ table { border-collapse: separate; border-spacing: 0; } caption, th, td { text-align: left; font-weight: normal; } blockquote:before, blockquote:after, q:before, q:after { content: ""; } blockquote, q { quotes: "" ""; } for some reason the text inside the item class will not center. see the attachment. the top is how this code renders, the bottom is how i'd like it to look. i'm sure this is something simple that i'll end up slapping myself fore later 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"> <html> <head> <title> new document </title> <style type="text/css"> #ticker { background: #00f; overflow: auto; margin-left: 20px; margin-top: 10px; width: 835px; height: 52px; } #ticker #items { position: relative; top: 0px; } #ticker .cell { display: table-cell; vertical-align: middle; height: 51px; overflow: hidden; border-right: 3px solid #01364d; text-align: center; } #ticker .item { float: left; padding: 0 10px 0 10px; font: bold 10pt Arial; color: #fff; } </style> </head> <body> <div id="ticker"> <div id="items"> <div class="cell" id="item_01" style="width: 160px"><div class="item">Lorem: XXX%</div></div> <div class="cell" id="item_02" style="width: 160px"><div class="item">Lorem: XXX%</div></div> <div class="cell" id="item_03" style="width: 160px"><div class="item">Lorem: XXX%</div></div> <div class="cell" id="item_04" style="width: 160px"><div class="item">Lorem: XXX%</div></div> <div class="cell" id="item_05" style="width: 160px; border: 0"><div class="item">Lorem: XXX%</div></div> </div> </div> </body> </html> Thanks for reading my question Why does this not center the contents of my page in Firefox but it does in IE? This code is in my linked CSS file. Code: body { text-align: center; margin-top: 10px; background-image: url(images/fall-leaves.jpeg); background-attachment: fixed; /*background-color: #d8d8d8;*/ } Thanks for taking the time to read my question. I have a 19 in CRT and a 22 in wide screen LCD monitor. I am trying to make my content center on the page, regardless of the monitor. As it stands, it looks to be centered on teh 19 in, but on the 22 in, it is very much to the left side of the screen. I just got the 22 in. Is there something different you have to do for wide screen monitors? I'm using margin: auto 0px; I have margin and padding off for my Body {} and have set marging and padding on all appropreate elements so that they work the same in IE and FF. In my html page, I'm using xhtml strict. Thanks, Brad Thanks for taking the time to read my question. I have a div that has a specified width, and if I put margin-left: auto; and margin-right: auto; the div centers with in the parent div. I have another div that I don't want to have a specified width, and as a result the auto's don't center the div. How can I center my div? I've tried display: block; and that just makes it as wide as the parent div. If I remove display and put float: left, it sizes properly (shrinks to fit the contents), but floats left and doesn't heed the margin auto's. The colors are there to see the containers... I don't plan on keeping them.. please see http://www.scopicdesigns.com/LisaCl..._Portfolio1.htm for example. Thanks, Brad Hi How do I center element <ul id="buttons"> in <div id="alertbox" ? Code: <div id="alertbox" style="background-color:#99CC99"> <h3 id="alerttitle"><span>DO YOU WANT TO CONTINUE ?</span></h3> <div id="alertcontent"> <ul id="buttons"> <li><a href="yes.php">YES</a></li> <li><a href="no.php">NO</a></li> </ul> </div> </div> <style type="text/css"> #alertbox { text-align: center; list-style-type: none; padding: .2em 0; } #alertbox li { display: inline; } #alertbox a { padding: 5px 20px .3em 20px; border: 1px solid #cccccc; } </style> Thank you. I have no idea what I'm doing incorrectly but I cannot get the gallery to display in the center of my page, it keeps going to the right. It is also bumped down a little so it isn't as far up as it could be. You can see it HERE Hi I want to display a line within div, but I want to display the DIV itself and not the line within DIVs into the center of the page, I want to display it proportionally as it appears in a cell so its width should be 80% of available space and it should be displayed in the center of the area... when i use attribute align=center it pushes the line in the centre but not the div itself.. many thanks in advance. |