CSS - Padding For No Reason, But Remedied By Border?
Code on the page:
Code: <body> <div class="wrapper_page"> <div class="wrapper_widebackground"> <div class="wrapper_body"> <div class="wrapper_head"><img src="Header.jpg" width="1000" height="182" /></div> <div class="wrapper_nav_top"><!-- navbar goes here --></div> <div class="wrapper_main"> <div class="wrapper_main_insidebackground_blue"> <div class="wrapper_main_insidebackground_white"> <div class="wrapper_main_top"><img src="PageBodyTop.png" width="1000" height="35" /></div> <div class="wrapper_main_content"> <div class="wrapper_main_sword"> <!-- Content here --> </div> </div> </div> </div> </div> </div> </div> </div> </body> Stylesheet: Code: .wrapper_page { text-align: center; width: 100%; border: 0px solid #FFFF00; } .wrapper_widebackground { background-image: url(../Cloth.png); width: 1350px; background-repeat: no-repeat; margin: auto; clear: both; border: 0px solid #FF0000; } .wrapper_body { text-align: left; margin: auto; clear: both; width: 1000px; border: 0px solid #FF00FF; padding: 0px; } .wrapper_head { height: 182px; width: 1000px; border: 0px solid #33FF00; margin: 0px; padding: 0px; } .wrapper_nav_top { height: 24px; width: 1000px; border: 0px solid #FFFF00; margin: 0px; padding: 0px; } .wrapper_main { background-color: #000000; background-image: url(../background.jpg); margin: auto; padding: 0px; background-position: top; background-repeat: repeat; clear: both; border: 0px solid #99FFFF; } .wrapper_main_insidebackground_blue { background-repeat: no-repeat; background-image: url(..Blue.jpg); background-position: top; background-color: #000000; } .wrapper_main_insidebackground_white { background-repeat: repeat-y; background-image: url(..White.png); background-position: top; } .wrapper_main_top { border: 0px solid #00FF00; height: 35px; width: 1000px; margin: 0px; padding: 0px; clear: both; } .wrapper_main_sword { background-image: url(../Sword.png); background-repeat: no-repeat; background-position: right top; vertical-align: top; padding: 0px; margin-top: -14px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border: 0px solid #FF33CC; } .wrapper_main_content { border: 0px solid #FF9900; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 90px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; } Here's the issue. wrapper_main will not stretch all the way to the bottom of the page regardless of the amount of text. It maintains what seems to be a bottom margin whether I put a bottom margin of 0 there or not. (Currently, it is set to auto.) I thought maybe wrapper_body was causing the issue, but setting the padding to 0 on wrapper_body did not work. Here's the confusing part. If I set a border with a width of 1px on wrapper_main, it goes all the way to the bottom. However, the border looks bad on the page so I don't want the border. (I'd give you the URL, but the forums wouldn't allow it.) Why is this happening and how do I remedy it? Similar TutorialsFirst off, I'm a new member. I'd like to thank everyone for such a great board. My name is Mike and I'll be a very active user in this community as I enter the world of web design. I have a page with an embedded flash object. I created a CSS Border around the object, and would like to add padding to it so that text can wrap around it. I understand that when adding padding to an object, it actually pushes the border out. I want the padding to reflect outside the border and not inside. All of my CSS has to be inline (the company's site does not allow workers to access template files via FTP). Here's what isn't working: <div style="padding-left:10px;padding-bottom:10px;"> <div style="border: 5px solid rgb(198, 175, 144); float: right;position:relative;right:12px;bottom:9px;"> *flash code* </div> </div> As you can see, I tried adding padding-left and padding-bottom outside the border but the text is still going underneath the object. Is there a better solution to this (using inline css)? Thanks to all. I'm having a real hard time trying to figure out how to fix this css issue. I'm trying to fix what's in the 3rd table content that is the compose new pm message form so that it doesn't have any space between the form and the outer content just like it is on the template that says Form with Alternative Style in the form heading. I can't fix the content class rule because that completely messes up the rest of the page and you can see that if you go back to one of the other two tabs. Template: http://www.kansasoutlawwrestling.com/peach/forms.html My Page JSfiddle: http://jsfiddle.net/MtzqR/ I've written a menu in css and I want to show the user what page they are on by having a little block of colour next to the link that they are on. This link should explain it better: http://www.midwivesonline.com/test.html at least it will do in everything but IE6 on windows where it stretches out too far to the right. The problem lies in the css: http://www.midwivesonline.com/styles/test.css In particular: .currentpagep { padding-right: 155px; border-right: 5px solid #85306B; } If I set the padding-right to just 5px then it's perfect in IE6 but screwed up everywhere else. From the tests I've done I don't think that it's a doctype issue - but then again not sure what the solution is... I'd really appreciate any help on this, Cheers, Tim Hi, I have a problem with the css for the following page: http://www.designdictator.com/ For the img in the log i do use the following css: #content img { display : block; border : 1px solid #999; padding : 4px; margin : 20px 0; } but in IE6 the padding between the border and the img doesn't display. Firefox does all right. What's wrong? thanx jarra Hello, is it possible to start a border-left css 1 or 2 pixels from the left of the element instead of it going to the far left of the element?? 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 guys, Ive been playing with this little bit of CSS for a while now and its' definitely getting the better of me. I have been using the demo on www.w3schools.com to create a horizontal menu. That has worked fine. I thought I could use a similar principle to create a horizontal menu. The whole idea is to create a CSS template, and then go through putting the ASP, etc in. I want to have a "leftpanel" on my site which will contain the navigation menu (that I am trying to create) and later make space for featured listings/whatever. Anyway, this is what I have: Code: ul.ver { width: 125px; padding: 0px; margin: 0px; text-align: center; border: 1px solid black; list-style-type: none; float: left; } a.ver { float: left; width: 125px; text-decoration:none; color: black; padding: 0.2em 0.6em; border: 1px solid black; background-color: #A2B5CD; } div.leftpanel { background-color: #CAE1FF; width: 125px; float: left; margin: 0px; padding: 0px; } And the HTML is: Code: <div class="leftpanel"> <ul class="ver"> <li><a class="ver" href="#">MenuA</a></li> <li><a class="ver" href="#">MenuB</a></li> </ul> </div> The problem that I have is that no matter what the width of the <a> tags are, and what the width of the "leftpanel" is, there is always 20-ish pixel width strip of the "leftpanel" showing through, even though they are the same width, with no padding, no margins, no nothing! If I play with the padding on the <a> it seems to have no effect! Thanks to anyone who can offer me some help! Porky. Hi, I just was wondering if there is a way to load an image as background of a div with a 1px padding from the border of that same div. At the moment I have to create two divs. The first div has the border and a padding of 1px and the second div loads the image as background! However I was wondering whether I could do all this in one. Regards, Sim085 I am designing a site which has a vertical nave which when an item in the list is hovered over it adds the left and right border and decreases the padding by 5 px: Code: #navlist2 a { width: 168px; /* extend the sensible area to the maximum with IE5 */ display: block; text-align: left; text-decoration: none; color: #fff; margin-top:5px; margin-bottom: 5px; padding-top: 5px; padding-bottom: 5px; padding-left: 10px; font-size: 12px; font-weight: bold; } #navlist2 a:visited { } #navlist2 a:hover { width: 163px; border-left: 5px solid #fff; border-right: 5px solid #fff; padding-left: 5px; } It works fine in firefox, but I noticed that there is massive slowdown/lag . So im wondering, why this is happening in IE and how can I fix it? Hello. Look at the differences between the borders around photos he http://www.fusionfox.com/2006/02/tinker_toys.html In Firefox and in IE. My CSS looks like this: .imageleft { float:left; margin:10px 10px 10px 0; background:#FFFFFF; padding:3px; border:1px dotted #999999; } Why does the image border disappear in IE? This is killing me. Any help would be greatly appreciated. Thanks! Hello, Is there a way to have padding (say 15px) all around a cell, but allow for expections, like having one div element float:left and align far left against cell border while everything else is inset 15px. ie. Code: <style> #menubox { float:left; margin-left:15px; margin-bottom:7px; } .main_cell { padding:15px; } </style> <body> <table width=600 border=0 cellpadding=0 cellspacing=0> <tr> <td valign=top class="main_cell"><div id="menubox">table with menu items taht is achored far left against cell wall</div> Some text that wraps around "menubox" but needs to be padded around cell walls.</td> </tr> </table> </body> Thanks, Rey Hey everyone, I am making a design to kill some time, and I have come across a problem. I have a menu at the top which has no top padding unless I give it padding of 87px. I find this very odd, and it happens in every browser( Firefox 2.0.0.3, Opera 9, IE6-7 ); is it a bug in CSS itself or am I doing something wrong? Here is my code, maybe I am missing something. html4strict Code: Original - html4strict Code <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta http-equiv="Content-Style-Type" content="text/css"> <meta http-equiv="Content-Script-Type" content="text/javascript"> <title></title> <style type="text/css"> body { background-color: #082567; color: #FFFFFF; margin: 0; padding: 0; font-family: verdana,tahoma,"Bitstream Vera Sans",arial,helvetica,sans-serif; font-size: 12px; text-align: justify; } #top-menu { background-image: url( http://secretgeek.net/Gradient.aspx?Direction=H&Length=130&StartColor=082567&EndColor=0C39A1&Format=jpeg ); background-repeat: repeat-x; height: 130px; } #top-menu h1 { float: left; font-weight: bold; letter-spacing: -3px; font-size: 31px; padding: 5px; } #menu { float: right; list-style-type: none; text-align: center; } #menu li { display: inline; } #menu a { background-image: url( http://secretgeek.net/Gradient.aspx?Direction=H&Length=130&StartColor=082567&EndColor=0C39A1&Format=jpeg ); background-repeat: repeat-x; color: #FFFFFF; padding: 50px; } #menu a:hover { background-image: url( http://secretgeek.net/Gradient.aspx?Direction=H&Length=130&StartColor=0C39A1&EndColor=082567&Format=jpeg ); background-repeat: repeat-x; } </style> </head> <body> <div id="top-menu"> <h1>ryon.hunter</h1> <div id="menu"> <ul> <li><a href="">asdf</a></li> <li><a href="">asdf</a></li> <li><a href="">asdf</a></li> <li><a href="">asdf</a></li> <li><a href="">asdf</a></li> </ul> </div> </div> </body> </html> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" I validated it and it validates fine, any suggestions? For some reason my code adds a vertical scrollbar in firefox (although not in IE but you can make anything work in IE). I am not sure why. The scroll amount is only 1 pixel vertically. Everything looks good to me. Any ideas? PHP Code: <style type="text/css"> <!-- html {height:100%;} body { margin:0; padding:0; height:100%; background:#ffffff url(bg.gif) top right repeat-y; font-family:Papyrus, Rockwell, Poor Richard, Times New Roman, serif; } #wrap { position:relative; background:url(bg.gif) top left repeat-y; min-height:100%; } * html #wrap {height:100%} #clear_footer { clear:both; height:19px; overflow:hidden; } #footer_full_width { position:absolute; bottom:0; height:19px; background-image: url(../images/bottomredstripe.jpg); width:100%; color:#fff; background-color: #999; text-align:center; } #footer_panel { position:relative; bottom:0; height:19px; background-image: url(../images/gray_bottom.jpg); width:730px; height: 19px; color:#fff; background-color: #999; text-align:center; } #left { float:left; width:200px; text-align:center; } #main { position:relative; margin-left:200px; } #right { float:right; width:200px; text-align:center; } #content { padding:5px; margin-right:200px; text-align:left; } * html #content, * html #main { height:1px; } --> </style> <div id="wrap"> <div id="header">header</div> <div id="left">left</div> <div id="main"> <div id="right">right</div> <div id="content">main content</div> </div> <div id="clear_footer"></div> <div id="footer_full_width"> <div id="footer_panel">FOOTER</div> </div> </div> For some reason (therefore contradicting my thread title) the horizontal scroll bar keeps popping up on my site. I've gone through and checked the width of all my divs and everything seems to be checking out. Here is the site university square condos (dot) com Any idea where I could be going wrong? Hello. I am using a percentage bar javascript code on my website, the problem is, The script works fine in FireFox without adding: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> But only works in IE if I add that code. The problem is, when I do add that code some of my tables go twice the size in height. What is the problem here? Is this going to be easy to fix? What can I do? Thanks a lot, Ben Hi guys, I'm working on a layout for a client, and I've run into a problem I've never seen before. My code is fully valid CSS (except for the *html IE fixes) and fully valid transitional XHTML, and it works fine in FF, IE and even Safari - but as soon as I load it up in Opera, it breaks completely. The font size is absolutely HUGE for some reason (like 400% of normal!), and it is completely breaking my layout. I have no idea why this would be happening, and it's immensely annoying. I'm setting all of the font sizes throughout the page in ems, and at the start of the css I declare the following: Code: html, body { height: 100%; margin: 0px; padding: 0px; text-align: center; font: 62.5% Tahoma, Verdana, Arial, Sans-Serif; /* Resets 1em to 10px */ background-color: #000000; } Now this should be fine, and indeed it works in every other browser.. but Opera is wigging the hell out, and I don't know what's wrong. Has anybody ever experienced anything like this? If so, please let me know! I'm hesitant to post the full code because it's covered by a hefty NDA, but I can strip out confidential bits if needed. Thanks everyone! Hi. Have created some simple tabs using table cells. Active tab should have bottom-border color equal to page background-color. Non-active tabs should have bottom-border=black. Works fine in IE, but does not work very well in Firefox. If I remove the border-collapse:collapse on the table, then firefox also work... but I would like to be able to keep the 1px border between each table cell. So is there a way to make this work in both IE and Firefox... and hopefully most other browsers... See code below: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html> <head> <style type="text/css"> a.menu_top:link {color: #000000; text-decoration: none;} a.menu_top:visited {color: #000000; text-decoration: none;} a.menu_top:hover {color: #000000; text-decoration: none;} a.menu_top:active {color: #000000; text-decoration: none;} td.menu_top_passive { background-color: #777; border-left: 1px #000000 solid; border-right: 1px #000000 solid; border-top: 1px #000000 solid; border-bottom: 1px #000000 solid; text-align: center; cursor:pointer; font-weight: bold; padding: 5px 20px 5px 20px; margin: 0; } td.menu_top_active { background-color: #bbb; border-left: 1px #000000 solid; border-right: 1px #000000 solid; border-top: 1px #000000 solid; border-bottom: 1px #bbb solid; text-align: center; cursor:pointer; font-weight: bold; padding: 5px 20px 5px 20px; margin: 0; } </style> <script language="JavaScript"> function change(id, url) { for (i=1; i<6; i++){ eval("document.getElementById("+i+").className='menu_top_passive'"); } eval("document.getElementById("+id+").className='menu_top_active'"); } </script> </head> <body style="margin:0; padding:0; background-color:#bbb;"> <br><br> <center> 1. Load the page.<br> 2. Click Item 4.<br> 3. Click Item 2.<br><br> Why is the bottom border of the menuelements (table cells) not getting correct in Firefox?<br> None-active menuelements should have a border-bottom = black, active should have same bottom-border as page.<br> Notice that I use border-collapse on the table in order to get the cell-border 1px thick between the menuitems.<br> If I remove border-collapse, then there is no strange behaviour in Firefox.<br> Any way to get this working in Firefox without breaking it in IE? </center> <br><br><br> <table border="0" cellpadding="0" cellspacing="0" align="center" style="border-collapse:collapse;"> <tr> <td id="1" nowrap class="menu_top_active" onClick="change('1');"><a href="javascript:;" class="menu_top">Item 1</a></td> <td id="2" nowrap class="menu_top_passive" onClick="change('2');"><a href="javascript:;" class="menu_top">Item 2</a></td> <td id="3" nowrap class="menu_top_passive" onClick="change('3');"><a href="javascript:;" class="menu_top">Item 3</a></td> <td id="4" nowrap class="menu_top_passive" onClick="change('4');"><a href="javascript:;" class="menu_top">Item 4</a></td> <td id="5" nowrap class="menu_top_passive" onClick="change('5');"><a href="javascript:;" class="menu_top">Item 5</a></td> </tr> </table> </body> </html> I'm a little puzzled by this weird display bug by IE7, this bug doesn't occur in IE6. It had to do with the DIV's CSS's border-style. If you set it to double then you notice some random bugs with it. Some of the time, the border is displayed without a problem. Some of the time, it is displayed with some gaps in the line as if it is not being drawn upon. Some of the other time, it is not displayed at all. I noticed if I switch from one tab to another then back, the border appeared as if nothing had happened. I also noticed that if I open the view source that overlapp the web browser then closed it, the border appeared as if nothing had happened. How do you fix that problem? Thanks... Hi, This used to be my solution: Code: <table border=1 bordercolorlight='#CCCCCC' Bordercolordark='#FFFFFF'> But this only works well on IE - not Mozilla Now I want to use CSS: Code: .results { border: 1px solid #CCCCCC ; } Code: <table class='results'> --------------- The problem is, with CSS, only the TABLE acquires the border property. The cells within it don't. If I specify Code: <td class='results'> for all the cells in the table, this also won't work, because the cell borders overlap each other and some border lines seem thicker than others (because of overlapping). Is there any simple way I can specify the border property for the table - in ONE declaration? I want the table and td borders all to be a simple 1px width ...is that possible in one declaration? Thanks a lot! I would like to set up a table with a different border than the cells inside it. Here's my code: 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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> TABLE {border: 1px solid black; border-collapse: collapse; width: 200px} TD {border: 1px solid #ccc} </style> </head> <body> <table> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> </table> </body> </html> That's all hunky dory in (gasp!) IE, but good browsers...they only show the lighter gray color. How do I get the table border to be different? |