CSS - Cannot Center Css Layer...
Hi all,
I'm trying to center a CSS layer, and have tried everything google and I can find on the web about CSS centering, but none work. I simply cannot get the following "menu" to center horizontally in a browser window [note: I *can* get it to center if I set the left and right margins of the "menu" layer to the same value, but that stretches the "BDB76B" colored background out, which I don't want to do]. Any help appreciated - thanks in advance to any takers! Here is the relevant code in the html document: <div id="menu"> <a href="index.html" class=menu_link>home</a> <a href="services.html" class=menu_link>services</a> <a href="hosting.html" class=menu_link>hosting</a> <a href="testimonials.html" class=menu_link>testimonials</a> <a href="tips_tools.html" class=menu_link>tips & tools</a> <a href="contact.html" class=menu_link>contact</a> </div> and here is the relevant code from my style sheet: #menu { background: #BDB76B; position: absolute; top: 85px; height: 15px; width: 800px; padding-bottom: 5px; z-index: 100; } a.menu_link, a.menu_link:visited{ font-size: medium; color: #808000; font-family : "Gill Sans MT", "Gill Sans", GillSans, Verdana, Arial, Helvetica, sans-serif; font-weight: normal; font-variant: small-caps; margin: 0px; padding: 2px 5px 4px 5px; text-decoration: none; } a.menu_link:hover{ font-size: medium; color: black; font-family : "Gill Sans MT", "Gill Sans", GillSans, Verdana, Arial, Helvetica, sans-serif; font-weight: normal; font-variant: small-caps; margin: 0px; padding: 2px 5px 4px 5px; text-decoration: underline; } Similar TutorialsI want to take a layer and center on a page. In other words if I have the margins top = 0 and left=0 then inside the main layer which takes into account the entire page I want it to be centered on the page. At present I can center a table on a page but not a layer???? how to do this? thanks is there any way of center aligning a div layer on a page by not nesting it within another layer. heres the codes i tried but it didnt work: <div align="center" id="Layer1" style="position:relative; width:268px; height:75px; z-index:1; text-align:center"></div> Hello I thought I could make it, but what I got so far is jumping over the screen, so please a need some help. I got a image with two transparant shapes. Behind those shapes I would like to show 2 other images. |-------1-------| | |-----| |----| | | |...2..| |..3..| | | |____| |____| | |_____________| Image 1 should be on top z-Index Image 2 should under image 1, a part of the image should be visible. Image 3 should under image 1, a part of the image should be visible. Now the issue, image 2 and 3 should be dynamically replaceable. Please help Thanks 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> Hi! Does anybody have some great link or book advice about all the properties of the DIV and/or LAYER - tags? Inspiring examples with javascript to this are also welcome. I will use it to build advanced layer functionality. Regards Bjorn I have a webpage located at http://www.niu-sae.com I have a drop down menu image, in a div layer that will pop up when you roll over the first link "Active Chapter". First of all the positioning is all weird... when I am at full screen I have to set the div left at 285... even though it is really only about 116. any idea what I am doing wrong? Second even when I get it lined up... the way it is now... it changes if you resize the window. HELP. please. I have a web page containing 3 layers. There are placed side by side with absolute positions. The middle layer contains a image with a fixed size. Now I have to change the image based on user's selection, so it is no longer fixed sized. I want to let the third (right) layer to re-adjust its position when image is smaller. How to make it work? This is my first time working with layers, please help. Thanks. Matt I've been re-designing my site in valid XHTML 1.1 and CSS, and I've hit a bit of a problem.... Everything works perfectly in Firefox, but IE isn't liking things at all. The navbar at the left should stretch all the way to the bottom image, but it isnt having it. I've tried messing with it for about an hour now, and can't fix it.... The page can be found at URL and the stylesheet at URL Oh, and I know the colours are all messed up, I'll fix that later :P Edit: Fixed bbCode Hi, I'm trying to set up a side menu, which appears on the right-hand side of the page. Code: <style type="text/css"> #SideMenu { color: #639; background-color: #FBFBFB; position: absolute; top: 275px; left: 630px; width: 190px; height: 250px; } </style> However, when the browser window is resized, the layer then obstructs the main content (by floating over it), and does not remain in its place as it should. This is how it should look like:: However, as the browser is resized, the layer does this: I'm tring to remedy this using CSS only, so please send any suggestions to me. The code for the sidebar is: Code: <div id="SideMenu"> <p>Side Content. I like to eat food.</p> </div> Any ideas guys?! http://balmarketing.com/new/ I think actually the trouble lies in my content layer not centering itself correctly and its being pushed to the right by the nav layer. It looks semi what I want it to look like in FF but not in IE. Any suggestions on how I can fix this? Well, I can't post links so this is going to be hard as hell to type out. I have a layer within that page that I want in a certain position, yet when I move the width of my browser the layer does not stay where I want it. Obviousely, this does not make any sense because its something you have to see. I checked the rules for the forums and I can't find where it states anything about URLs, if someone would be so kind to show me, I'd appericiate it. Not that it matters witout seeing it on the page but my code for this layer is: Code: <div id="Layer1" style="position:absolute; left:848px; top:85px; width:118px; height:167px; z-index:1"> <div class="mltop">schedule +4hrs </div> <p>00:00 - Music <br> 01:00 - Music <br> 02:00 - Music <br> 03:00 - <a href="">BRR</a></p> <p><b>Current time: 00:00</b><br> Times in CST/CDT <br> </p> </div> Hi Guys, Basically I'm having trouble with getting the 'Content' div layer to wrap around the switching div layers. The grey background colour represents the 'Content' div layer which wraps around the button menu OK but doesn't wrap around the layers which switch. The bodged way of doing it is to have a fixed height but then it leaves a blank area underneath the divs that are short of text...If you get what I mean? Code: <div id="content_test"> <div id="rollovercontentwrapper"> <div id="tabwrapper"> <ul id="tabmenu"> <li><p><a href="#" onClick="javascript:showTabContentOne('TabContentOne')">Summary</p></a></li> <li><p><a href="#" onClick="javascript:showTabContentTwo('TabContentTwo')">Benefits</p></a></li> </ul><!--TABMENU--> </div><!--TABWRAPPER--> <div id="TabContentOne" class="TabContentOne" style="visibility: hidden"> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer lacus risus, porttitor non aliquam non, scelerisque vitae turpis. Duis venenatis nisl lectus, et aliquam eros. Nam commodo, ligula sed ultrices vehicula, justo augue ultricies urna, sed rhoncus nisi dui sed risus. Nullam commodo risus nec justo sagittis eu cursus nisi interdum.</p> <br> <p>In hac habitasse platea dictumst. Sed vulputate auctor cursus. Morbi ac ullamcorper dui. In sem velit, pulvinar sit amet cursus id, vulputate fringilla erat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed lorem urna, imperdiet eget fringilla eget, molestie nec justo. Fusce diam nulla, fringilla a sodales at, rhoncus vitae massa. Donec tincidunt, leo quis fermentum venenatis, purus elit tincidunt ipsum, vitae sollicitudin nulla orci nec arcu. Sed non neque neque, ac pharetra lectus. Donec a massa mauris. Sed vel magna eget tellus commodo placerat in quis risus. Aenean velit lectus, aliquam quis dictum ac, pellentesque sed diam.</p> </div><!--TabContentOne--> <div id="TabContentTwo" class="TabContentTwo" style="visibility: hidden"> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer lacus risus, porttitor non aliquam non, scelerisque vitae turpis. Duis venenatis nisl lectus, et aliquam eros. Nam commodo, ligula sed ultrices vehicula, justo augue ultricies urna, sed rhoncus nisi dui sed risus. Nullam commodo risus nec justo sagittis eu cursus nisi interdum.</p> </div><!--TabContentTwo--> </div><!--ROLLOVERCONTENTWRAPPER--> </div> <!----CONTENT_TEST----> <div id="onebyone" style="visibility:hidden;"> <img src="onebyonepixel.gif" onLoad="javascript:showTabContentOne('TabContentOne')" width="1" height="1"> </div> Code: div#rollovercontentwrapper { float: left; width: 630px; background-color: #E9E9E8 } div#tabwrapper { width: 630px; } ul#tabmenu { display: block; float: left; width: 630px; list-style-type: none; border-bottom: 1px solid #0048A7; } ul#tabmenu li { display: block; float: left; background-color: #E9E9E8; } ul#tabmenu li a { display: block; float: left; padding: 10px; background-color: #E9E9E8; border-top: 1px dashed #0048A7; border-right: 1px dashed #0048A7; } ul#tabmenu li a:focus { display: block; float: left; padding: 10px; background-color: #3383CD; border-top: 1px dashed #0048A7; border-right: 1px dashed #0048A7; } #TabContentOne { float: left; position: absolute; top: 350px; width: 628px; z-index: 1; padding-top: 10px; padding-bottom: 10px; } #TabContentTwo { float: left; position: absolute; top: 350px; width: 628px; z-index: 1; padding-top: 10px; padding-bottom: 10px; } div#onebyone { float: left; } div#content_test { float: left; width: 900px; padding: 20px; background-color: #CCCCCC; } Can anybody help me out on this? Many thanks, Mark Hello All, Im currently stuck trying to get a layer on top of a layer. The image below shows the problem. img68.imageshack.us/img68/5579/picture3cl2.png And here is a link to a code version: thenpcs.com/beta/ Any help greatfully appreciated! I need to position a 200px high by 300px wide layer in the center of the page. does anyone know a simple way to do this, i have thought about using JS to calculate the width of the page, take off the 200px, and halve it, but that seems like overkill, isnt there a simple CSS command? Thanks Xaphan Hi. Any help would be appreciated. I am trying to cut down on my image sizes on my website: http://toptiertemplates.com, but i am having a few difficulties. I have this table which was created in photoshop which is off to the side. I would like to take just a slice of the table and repeat the image the full length of the table's original length. The page is written by placing everything with divs. I know how to set the image as a background and all and repeat it, however, when i do so, it replaces my website's background and just shows up as a white space. So i am wondering if I have to use layers of some sort or anything else. I'd appreciate some help. Thanks. Hi, Does anyone know how I can do drop down layer with in a table. I have table whihc has the class name I want to show the description in a drop down fashion when user click on the class name. Does anyone knows How I can do this. Please help me. I am new to Css thanks Hi, I need to add some content (small div) over the top of a flash banner. I tried adding wmode="transparent" to both the object and embed tag but that didnt work. Any other suggestions? thanks Hello, someone call tell me why this code didnt work? i try to put some flash banner in nested divs using z-index and its not working the flash div is above the higher div. i am tryin to href the flash banner: Code: <asp:FormView DataSourceID="SqlDataSource20" runat="server"> <ItemTemplate> <div style="width:728px; height:90px; position:relative; padding:0px; margin:0px; z-index:100; cursor:pointer; display:block; background-color:Lime;" onclick="window.new('<%#Eval("destUrl") %>', '_blank');"> <div style="width:728px; height:90px; position:absolute; left:0px; top:0px; padding:0px; margin:0px; z-index:-1; display:block;"> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="728" height="90"> <param name="allowScriptAccess" value="sameDomain" /> <param name="allowFullScreen" value="false" /> <param name="movie" value="<%#Eval("bannerSrc") %>" /> <param name="quality" value="high" /> <param name="bgcolor" value="#ffffff" /> <param name="wmode" value="opaque" /> </object> </div> </div> </ItemTemplate> </asp:FormView> |