CSS - Fried Brain: Div Padding(?) Issue, Positioning
Hey,
In the top menu For some reason I can't seem to pick (after frying my brain working on this for the past however many hours) why there is such a huge empty space above the menu. I'm sure it's something simple I just keep missing. Also having trouble positioning the other menu without bloating up the css with potentially useless code. (-px, etc). Website style.css menu2.css (says menu two, but is just the second attempt at css for the first menu) Cheers for all help! Similar TutorialsHello, My site is www.jwwebdesign.info . It shows up fine in IE, but does not display correctly in Netscape (or Firefox says my friend). Can anyone point me to why the problem is occurring? As well, how can I change the padding without affecting the scroll bar of my div (if I increase padding, scrollbar goes off page because of width setting)? Thanks in advance, Jeff I am constructing a website using the sliding doors navigation (http://www.alistapart.com/articles/slidingdoors/ and http://www.alistapart.com/articles/slidingdoors2/). I have gone through both articles to successfully create the sliding doors naviagiton that I require. My header image that I wish to place behind the navigation is 780px wide by 263px high. Therefor, I will be placing this navigation at the bottom (baseline) of this image. I have increased my header div size to fit the image (780px x 263px). Then I have padded the navigation to try to make it position on the bottom of the image (padding-top: 236px). Unfortunatly, doing this give a 1px padding difference for IE and Firefox. IE shows it up fine, but Firefox does not. Firefox makes it look like its spaced 1px to many. If i decrease the padding to 235px, Firefox looks fine but IE displays it with 1px to less...I dont want to have to result to browser dependant css, but all hacks are welcome. Heres the code: Code: body { text-align: center; background-color: #7999E4 } #header{ width: 780px; background: url('images/head.gif') repeat-x bottom; font-size: 93%; line-height: normal; height: 263px; padding: 0; margin:0; border:0; } #main { background-color: #ffffff; width: 780px; height: 500px; } #nav2 { background-color: #e7e7e7; width: 100%; border-bottom: 1px solid #000; height: 20px; } #header ul { margin: 0; padding:0; padding-top: 236px; padding-left: 10px; list-style: none; } #header li { display:inline; margin:0; padding:0; } #header a { float: left; background: url('images/left_both.gif') no-repeat left top; margin: 0; padding: 0 0 0 9px; border-bottom: 1px solid #765; text-decoration: none; } #header a span{ float: left; display: block; background: url('images/right_both.gif') no-repeat right top; padding: 5px 15px 4px 6px; font-weight: bold; color: #765; } /* Commented Backslash Hack hides rule from IE5-Mac \*/ #header a span{float: none;} /* End IE5-Mac hack*/ #header a:hover span{ color: #333; } #header #current a{ border-width: 0; background-position: 0% -150px; } #header #current a span{ background-position: 100% -150px; padding-bottom:5px; color: #333; } #header a:hover { background-position:0% -150px; } #header a:hover span { background-position:100% -150px; } Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML> <HEAD> <TITLE></TITLE> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> <link title="Style" href="style2.css" type="text/css" rel="STYLESHEET"> </HEAD> <BODY> <center> <div id="header"> <ul> <li><a href="#"><span>Home</span></a></li> <li id="current"><a href="#"><span>Properties</span></a></li> <li><a href="#"><span>Quick Searches</span></a></li> <li><a href="#"><span>Holidays</span></a></li> <li><a href="#"><span>Contact</span></a></li> </ul> </div> <div id="main"> <div id="nav2"></div> </div> <div id="footer"> </div> </body> </html> Hi all, My CSS for a <DIV> is: Code: .title { width: 350px; background: #aaccff; padding: 0px 0px 0px 10px; border: 1px #cccccc solid; } When I enter text in the DIV, it shows a bit to the right of the left border, which is what padding property is supposed to do! The problem is, in Internet Explorer, this "shift" is PERFECT and there is no extension beyond the right border, but in Firefox, the background color can be seen extended 10px to the right border. I searched on internet and people called it a problem with I.E. Everywhere I visited, people seemed to curse a Microsoft product and give a line of code, "DOCTYPE" etc to force I.E. to change mode and behave like Firefox. Those guys dont understand that what the coder wants is a solution so that Firefox shows the DIV exactly like I.E. 1) So please! Stop cursing I.E. and give solution as to how to modify the code...! 2) A person said that the width is calculated as: width + padding + margin. In my case, since margin is "0", the suggession seemed to use the following code: Code: .title { width: 340px; background: #aaccff; padding: 0px 0px 0px 10px; border: 1px #cccccc solid; } i.e., subtracting the padding-left from width. But that makes "no sense" because if we do the above, it should do nothing but to just change the width of the DIV, and so the end result would be that in Firefox, instead of spanning to 360 px horizontally, this would cause it to span in 350px horizontally. Keeping in view that its the "only" DIV on the page, setting the width parameter should not be a problem. 3) Now, if Firefox follows standard, then how will firefox ever show the padding property correctly if the above scenario is considered...! 4) Microsoft may not follow the standards sometimes, but the result "is" userfriendly most of the times...! Thanks! just read a post on ALA regarding how to create a simple thumbnail gallery using CSS. while the styling of the CSS provided on ALA seems to render the same on both FF and IE, the original code renders slightly different. everything seems to work fine except for the padding around the caption, underneath the image. there is more space around then caption when viewed in IE. please look at this link where the html file and css are hosted - (view source) can you make out anything that could be adjusted to fix this tiny bug? really appreciate if you could help out a little here. been at this for the last couple of days, and now really dead with any ideas to fix this tiny issue :-/ thanx for your time, z Remove. Please look at the main navigation on this site www.downtowntransmission.com I have it exactly how I want it in IE7 but it is a bit off in FF. Mouseover the Contact link and Gallery Link and you will see what I mean. Is there some small adjustment I can make to make it look the same in both? As a side note, do you like the site? T On the sidebar of this page http://www.laurieannre.com/real-estate-agent.asp the UL titled Neighborhoods has a different padding on FF than in IE and I can not understand why? Hi, Im trying to make a simple bar with text in the center. Im having a lot of problems with it however, because its height is 50px not 25px. The bars in question are the ones that say "Description, Payment" etc I started by setting its height to 25px in the CSS but this didnt work. Ive tried adding padding: 0px to what I thought was the relevant tag, but this doesnt change it either! This is the address to the test page: http://www.zombiemod.com/test.html This is the code: 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" xml:lang="en" lang="en"> <head> <meta name="generator" content="HTML Tidy for Linux (vers 6 November 2007), see www.w3.org" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Testing</title> <style type="text/css"> /*<![CDATA[*/ #title { border-top:2px #000000 solid; border-bottom:3px #000000 solid; } #mainNav { margin: 0px; padding: 0px; list-style-image: none; list-style-type: none; float: right; height: 61px; } #mainNav li { float: left; margin-top: 38px; margin-right: 10px; margin-bottom: 0px; margin-left: 0px; } #mainNav li a { margin: 0px; background-attachment: scroll; background-image: url(http://img12.imageshack.us/img12/3157/tabs2d.png); background-repeat: no-repeat; background-position: right 0px; font-weight: normal; color: #efeeee; font-family: Verdana; text-decoration: none; height: auto; width: auto; float: left; padding-top: 0px; padding-right: 10px; padding-bottom: 0px; padding-left: 0px; } #mainNav li a:hover { font-weight: bold; color: #efeeee; } #mainNav li a span { background-attachment: scroll; background-image: url(http://img12.imageshack.us/img12/3157/tabs2d.png); background-repeat: no-repeat; background-position: 0px 0px; display: block; padding-top: 6px; padding-right: 20px; padding-bottom: 0px; padding-left: 30px; height: 19px; width: auto; float: left; cursor: pointer; cursor: hand; margin: 0px; } #horinav li { float:left; width:23%; text-align:center; } p.c13 {text-align: left} span.c12 {color: #efeeee} h3.c11 {color: #000000; font-family: Verdana; text-align: center} div.c10 {text-align: left} table.c9 {border-collapse: collapse} span.c8 {font-family: Verdana; font-size: 80%} p.c7 {font-family: Verdana; font-size: 80%} span.c6 {color: #000000; font-family: Verdana; font-size: 14} p.c5 {text-align: center} span.c4 {font-family: Arial, Helvetica, sans-serif; font-size: 200%} tr.c3 {background-image: url(http://img6.imageshack.us/img6/3518/63387888.jpg)} tr.c14 {background-image: url(http://img6.imageshack.us/img6/2466/bgthin.jpg)} span.c2 {font-family: Arial, Helvetica, sans-serif; font-size: 120%} span.c1 {color: #232323} </style> <style type="text/css"> /*<![CDATA[*/ img.c7 {padding: 5px; border: 1px solid #ffcc00;} tr.c6 {background-color: #000033} td.c5 {background-color: #FFFFFF} tr.c4 {background-color: #FFFFFF} li.c3 {list-style: none} tr.c2 {background-color: #FFEDA3} span.c1 {color: #EFEEEE} /*]]>*/ </style> </head> <body> <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" id="title"> <tr class="c3"> <td align="left"><span class="c2"><strong><span class="c1"><a name="top" id="top"><img src="http://img200.imageshack.us/img200/9856/alienware.gif" alt="** PLEASE DESCRIBE THIS IMAGE **" /></a></span></strong></span> <ul id="mainNav"> <li><a href="#Description"><span>Item</span></a></li> <li><a href="#Payment"><span>Payment</span></a></li> <li><a href="#Shipping"><span>Shipping</span></a></li> <li><a href="#Policies"><span>Pictures</span></a></li> </ul> </td> </tr> </table> <br /> <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center"> <tr class="c4" valign="top"> <td align="center"> <div class="c10"> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="c9"> <tr class="c14 c2"> <td width="100%" colspan="3"> <p class="c5"><strong><span class="c6"><a name="Description" id="Description"><span class="c1">Description</span></a></span></strong></p> </td> </tr> <tr> <td width="49%" align="left" valign="top"> <p class="c7"><br /> Test.</p> </td> <td width="2%" align="right" valign="top"></td> <td valign="top" width="49%"> <ul> <li class="c3"><br /></li> <li><span class="c8">Test</span></li> <li class="c3"><br /></li> </ul> </td> </tr> </table> </div> </td> </tr> <tr class="c14 c2"> <td> <p class="c5"><strong><span class="c6"><a name="Payment" id="Payment"><span class="c1">Payment</span></a></span></strong></p> </td> </tr> <tr class="c6"> <td class="c5" height="2"><br /> <br /> <span class="c8">Test.<br /></span><br /> <br /> <br /></td> </tr> <tr class="c14 c2"> <td> <p class="c5"><strong><span class="c6"><a name="Shipping" id="Shipping"><span class="c12">Shipping</span></a></span></strong></p> </td> </tr> <tr class="c6"> <td class="c5" height="20"><br /> <br /> <span class="c8">Put your Shipping information here.<br /> There are <br> tags here to fill the cell, take them out after inserting you text.</span><br /> <br /> <br /></td> </tr> <tr class="c14 c2"> <td> <p class="c5"><strong><span class="c6"><a name="Policies" id="Policies"><span class="c12">Pictures</span></a></span></strong></p> </td> </tr> <tr class="c6"> <td class="c5" height="20"> <p class="c13"><br /> <br /> <span class="c8"><br /></span></p> <ul id="horinav"> <li><span class="c8"><img class="c7" src="http://img528.imageshack.us/img528/4149/100nw3.png" alt="** PLEASE DESCRIBE THIS IMAGE **" /></span></li> <li><span class="c8"><img class="c7" src="http://img528.imageshack.us/img528/4149/100nw3.png" alt="** PLEASE DESCRIBE THIS IMAGE **" /></span></li> <li><span class="c8"><img class="c7" src="http://img528.imageshack.us/img528/4149/100nw3.png" alt="** PLEASE DESCRIBE THIS IMAGE **" /></span></li> <li><span class="c8"><img class="c7" src="http://img528.imageshack.us/img528/4149/100nw3.png" alt="** PLEASE DESCRIBE THIS IMAGE **" /></span></li> </ul> <br /></td> </tr> </table> </body> </html> Ive put it through a validator, now it validates, but it still doesnt work. I believe the tag in question is c14 and c2. Take a look at http://actrucking.com/. I just added the orange link towards the middle of the page that says "Get a FREE Online Quote Now!!" I'd like to push it down a bit so it is more centered in the blue area, but I can't seem to get the text to acknowledge margin or padding? Here are what the styles look like: Code: #tlCallBox { background:#336799; height:75px; display:block; float:left; width:868px; margin-left:10px; position:relative; margin-bottom:30px} #tlCallBox h2{ color:white; font-size:19px; margin: 15px 0 0 30px} #tlCallBox p { color:White; margin-left:32px} #tlCallBox b { margin:20px 0 0 120px; font-weight:bold; font-size:20pt} I'm building a series of navigation links in boxes on top of each other. I want to pad the links inside their div tags 3 pixels all the way around. I'm seperating the boxes using the border property, 1px solid on the bottom of each cell. The top and the bottom are handled in a seperate class. In firefox, the brower adds the 3 pixels to the overall width (maybe six since I'm padding left/right) so the page comes out like this: --------- | Link 1 | ------------- | Link 2 | ------------- | Link 3 | ------------- Now in IE, it looks correctly. I'm not sure which one is correct, but since IE looks right I assume it's correct. Any way to get the padding to be handled consistently in 2 browsers? Hi all, I've been reading this forum for a while now, but never had to post anything before. I've hit a snag whilst working on my new personal site. Its all fine in Firefox, I'm using a Wordpress engine to spit out 'posts' which are actually folio items, however IE, after the first one, the second one and every one after that have some extreme margin/padding issue so that the content area is only maybe 20px wide. www dot lucas-starbuck dot com forwardslash design is the site address, any ideas would be much appreciated! Thanks, Lucas Hi there, I am in the process of making a website to purchase tickets for Cannon and Ball's show in Morecambe, and I've tried to make it as standards compliant and usable as possible. I've made a nav bar using a UL tag. This works fine in opera and mozilla, but the hover effect doesn't kick in in IE until you are actually on the text. I've tried using the IE7 patch and that helps none. Can anyone tell me what I'm doing wrong? The site is: http://cannonandball.1stmorecambe.net/ Style sheet: http://cannonandball.1stmorecambe.net/style.css Hello, I am having an alignment issue that I can't seem to fix. The site is accessed he http://cbo4edu.org/newSite/index.html I've used 2 different CSS files... one for the homepage and one for all the other pages . For the homepage, I want the Mission headline to just touch the blue border from the navigation. Right now when viewed in Firefox on my Mac there is an extra white box above it with nothing in it... but in IE it looks fine. How do I get it to look the same in both browsers? For the other pages, I'm having a similar issue. I want about the same amount of white space above the main headings without the words getting cut off. How can I fix this in both browsers? Thank you in advance. I have a menu structure that I am trying to create with CSS. The features I want are the following:
Variable width elements
Resizable text from user
Image at left of link
I have an example page up he URL I've got it working with a table, but when I've tried with a unordered list, I start having problems. Here's what is happenning: Firefox -- when I put padding on my anchor tags, the anchor elements expand outside of the list item elements. Firefox -- anchor elements don't expand to the full width of the list item element. Internet Explorer -- IE seems to only allow for fixed/percentage with list item elements. Is there a way to allow for variable width elements? Thanks for the help! -- Doug Hi everyone, For years I've been using tables solely to position elements on web pages but it's come to my attention that this is now "frowned" upon in the web community so I figured if I'm going to start doing things the more common way (with DIVs) I might as well start now. I'm not a professional website developer (C programmer here...eek! haha), but I do part time web work for some important clients of mine. So I have a very simple layout done with DIVs/CSS to start (code at the bottom). The problem is when you render it you'll see a large gap between the bottom of the layout and bottom of the page. My hypothesis is that this is due to where the "DIVs" would normally have been, except I moved them around. It sounds very similar to the problem encountered he http://forums.devshed.com/css-help-116/how-to-remove-blank-space-at-bottom-554773.html but I don't see what he did to solve it. Note that ultimately what I want is only the "header" and "footer" to have a fixed width/height. The leftcol and content should have fixed widths, but height grow with what ever is in them. And it should be centered in the page the way it is now. I tried various "text-wrap" and "height: 100%" and a few different codes but no luck. I really don't want to have to give up on DIV's but I am finding them a tad frustrating . I've altered the code from here (http://www.devarticles.com/c/a/Web-Style-Sheets/DIV-Based-Layout-with-CSS/3/). I tried "floating" them but that didn't seem to help either or is messes up my centering, plus I don't want it expanding to different resolutions. Thanks in advance if you can give a DIV newbie a heads up. Code: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>TWO-COLUM FIXED LAYOUT WITH FIXED BOXES</title> <style type="text/css"> <!-- #header { background: #0f0; position: relative; z-index: 1; top: 0px; left: 0px; width: 800px; height: 100px; } #leftcol { background: #f00; position: relative; z-index: 2; top: 0px; left: -325px; width: 150px; height: 600px; } #content { background: #ff0; position: relative; z-index: 3; top: -600px; left: 75px; width: 650px; height: 600px; } #footer { background: #0f0; position: relative; z-index: 4; top: -600px; left: 0px; width: 800px; height: 100px; } --> </style> </head> <body style="margin: 0pt;"> <div align="center"> <div id="header">Header Section</div> <div id="leftcol">Left Section <p align="left"> Test </p> </div> <div id="content">Content Section</div> <div id="footer">Footer Section</div> </div> </body> </html> I have a page with a bunch of DIVs i'm trying to get positioned correctly. I want to have two DIVs sit next to each other, so I float one, right? I can get them to sit next to each other, but then the top line of the content in the 2nd DIV sinks down below the floated div. I can't get it to work. Any help? CSS: Code: html{} body{ color: #000000; margin: 0; padding: 0; background-color: #666666; } .container{ height: auto; width: 650px; margin: 0px 0px 0px 0px; background-color: #333333; } /* Container Styles */ #news{ float:left; position:relative; width: 295px; background-color: #FFF; margin: 0px 0px 10px 25px; } #contact{ width: 295px; background-color: #FFF; margin: 0px 0px 10px 0px; position:relative; left: 325px; } HTML: Code: <div class="container"> <div id="news"> <h2>News</h2> <ul class="newslist"> <li>12.11.03 + news text...</li> <li>11.12.02 + more news text...</li> </ul> </div> <div id="contact"> <h2>Contact</h2> <ul class="contactlist"> <li><a href="#">mail be...</a></li> <li><a href="#">Design by ....</a></li> </ul> </div> </div> Thanks! Hi I am not really very familiar with the positioning element. I have a site that has a fixed width in the center of the page. It all works fine. However there is a hidden box that pops up when you enter any text in the newsletter box at the top right - this appears outside of the fixed width and I cannot understand why it is allowed to do so. I notice that it does have "absolute" positioning defined in the CSS. Any clues as to what I can do to bring it back to its correct place under the newsletter box? Thanks a lot Site: http://www.componentcompare.com I have a two column DIV arrangment (inside a one coulmn page layout), and above it, I want a single div that will contain absolut positioned images. Here's the two column CSS: Quote: /* 2 column div setup for map and sidebar */ #mapwrap { width:980px; margin:0 auto; } #mapmain { float:right; width:680px; } #mapsidebar { float:left; width:300px; } #testimg { position:relative; left:100px; top:150px; } And... Code: <div id="buttondiv"><img src="/images/buttons/7on.png" id="testimg"></div> <div id="mapwrap"> <div id="mapsidebar"> <div id="findaddydiv"> Something </div> </div> <div id="mapmain"> Something Else </div> </div> My problem is that when I build the DIV for the images in the code above the two column set-up, and view the whole thing, the images are ON TOP of the two coulun DIVs. How to force the image DIV to be ABOVE the two-column set-up? Hello, Im making my Dad a website for his London Tour company, and ive pretty much got everything the way i want, i just need to add the content. However my only issue is that the positions of certain things changes in I.E.. Example: http://www.aranock-online.com/projecta In Firefox it works fine, In i.e it doesnt I am learning css and ran into a problem I can't figure out. When I add text in my main content div, it does push my footer down like I want it to. However, it keeps the existing space in the div between the content and the footer leaving a large gap at the bottom of the screen. Can anybody help me? The developing site is he thinkfishdesign - dot - com/temp/tf/ This is the css code : Code: @charset "utf-8"; /*------------------- Style Template -------------------*/ /*------------------- HTML Styles -------------------*/ body { text-align: center; margin: 0px; background-color: #FFF; } p { font-family:Arial, Helvetica, sans-serif; font-size: 1em; line-height: 1.3em; } /*------------------- Structural Styles -------------------*/ #container-content { position:relative; margin:0 auto; height:auto; width:980px; height:auto; text-align:left; } #container-page { position:relative; width:100%; height:auto; text-align:center; } #content-container { position:relative; top:-17em; width:100%; } #content { position:relative; left:13em; top:-33em; width:45em; } #content-main { position:relative; width:100%; height:auto; } #footer { position:relative; top:0em; width:100%; height:12.6em; } .footer { background-image:url(images/template_footer.jpg); background-repeat:no-repeat; } #intro { position:relative; left:20em; top: -34em; width:38em; height:8.8em; white-space:normal; } #logo { position:relative; left:50em; top:-19em; width:11em; height:11em; } .logo { background-image:url(images/template_logo.jpg); background-repeat:no-repeat; } #photo-main { position:relative; left:1em; top:1em; width:16em; height:20em; } .photo-main { background-image:url(images/template_fish.jpg); background-repeat:no-repeat; } /*------------------- Side Navigation Styles -------------------*/ #nav-container { position:relative; left:1.3em; top:-12em; width:12em; height:19em; } .nav { font-family:Arial, Helvetica, sans-serif; font-size: .8em; line-height: 1em; } .link-nav a { color: #000; text-decoration: none; } .link-nav a:visited { color: #000; text-decoration: none; } .link-nav a:hover { color: #F60; text-decoration: underline; } /*------------------- Footer Navigation Styles -------------------*/ #footer-nav{ position:relative; top:13em; left:3em; width:40em; height:2em; } .nav-footer { font-family:Arial, Helvetica, sans-serif; font-size: .8em; line-height: 1em; } .link-footer a { color: #F60; text-decoration: underline; } .link-footer a:visited { color: #F60; text-decoration: underline; } .link-footer a:hover { color: #900; text-decoration: underline; } |