Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > CSS > CSS Cascading Style Sheets
|
CSS Cascading Style Sheets All issues relating to Cascading Style Sheets (CSS).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the CSS Cascading Style Sheets section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 30th, 2007, 09:18 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 238
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via MSN to rsearing
Default Why roughly 3px gap at bottom of stuff?

Ok...I know this has to do something with IE6 compatability--as this works great in IE7. Basically, I am getting about a 3px gap below the images I am using and the bottom border. I've messed around with the header quite a bit...

The header pic (sunbanner.jpb) is 796 x 295 px.

I have messed with explicitly putting a variety of different heights on "div#header" and leaving it blank.

Please help.

Here is my HTML:

<!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=iso-8859-1" /><title>
    About The Artist
</title><link href="mainstyle.css" rel="stylesheet" type="text/css" />

<script language="javascript" type='text/javascript' >
function EvImageOverChange(name, direction)
    {
        switch(direction)
        {
            case 'in': name.src = 'Site_Images/' + name.id + 'Selecting.bmp';
            break;
            case 'out' : name.src = 'Site_Images/'+ name.id + 'white.bmp';
            break;
            case 'neither' : name.src = 'Site_Images/' + name.id + 'selected.bmp';
            break;
        }
    }


</head>

<body>
<form name="aspnetForm" method="post" action="default.aspx" id="aspnetForm" accept="4">
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/=" />
</div>

<script type="text/javascript">
<!--
var theForm = document.forms['aspnetForm'];
if (!theForm) {
    theForm = document.aspnetForm;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
// -->
</script>


<script src="/WebResource.axd?d=7wDI-3sNJCame3klgZ_Veg2&amp;t=633185801258125000" type="text/javascript"></script>

    <div id='main'>
        <div id='header' >
            <img src="Site_Images/Sunbanner.jpg" />
         </div>
        <div id='aboutbutton'>
            <input type="image" name="ctl00$AboutButton" id="ctl00_AboutButton" OnMouseOver="javascript:EvImageOverChange(this, 'in');" OnMouseOut="javascript:EvImageOverChange(this, 'neither');" src="Site_Images/ctl00_aboutbuttonselected.bmp" onclick="javascript:WebForm_DoPostBackWithOptions( new WebForm_PostBackOptions(&quot;ctl00$AboutButton&qu ot;, &quot;&quot;, false, &quot;&quot;, &quot;default.aspx&quot;, false, false))" style="border-width:0px;" />
        </div>
        <div id='exhibitbutton'>
            <input type="image" name="ctl00$ShowsButton" id="ctl00_ShowsButton" OnMouseOver="javascript:EvImageOverChange(this, 'in');" OnMouseOut="javascript:EvImageOverChange(this, 'out');" src="Site_Images/ctl00_showsbuttonwhite.bmp" onclick="javascript:WebForm_DoPostBackWithOptions( new WebForm_PostBackOptions(&quot;ctl00$ShowsButton&qu ot;, &quot;&quot;, false, &quot;&quot;, &quot;shows.aspx&quot;, false, false))" style="border-width:0px;" />
        </div>
        <div id='awardsbutton'>
            <input type="image" name="ctl00$AwardsButton" id="ctl00_AwardsButton" OnMouseOver="javascript:EvImageOverChange(this, 'in');" OnMouseOut="javascript:EvImageOverChange(this, 'out');" src="Site_Images/ctl00_awardsbuttonwhite.bmp" onclick="javascript:WebForm_DoPostBackWithOptions( new WebForm_PostBackOptions(&quot;ctl00$AwardsButton&q uot;, &quot;&quot;, false, &quot;&quot;, &quot;awards.aspx&quot;, false, false))" style="border-width:0px;" />
        </div>
        <div id='artbutton'>
            <input type="image" name="ctl00$SunsartButton" id="ctl00_SunsartButton" OnMouseOver="javascript:EvImageOverChange(this, 'in');" OnMouseOut="javascript:EvImageOverChange(this, 'out');" src="Site_Images/ctl00_sunsartbuttonwhite.bmp" onclick="javascript:WebForm_DoPostBackWithOptions( new WebForm_PostBackOptions(&quot;ctl00$SunsartButton& quot;, &quot;&quot;, false, &quot;&quot;, &quot;artgallery.aspx&quot;, false, false))" style="border-width:0px;" />
        </div>
        <div id='container' style="position:relative; margin-top:59px;">

    <div id='sunpic'>
        <img id="ctl00_ContentPlaceHolder2_Image1" src="Site_Images/Portaitofsun.jpg" style="width:250px;border-width:0px;" />
    </div>
    <div id='abouttext' >
        <span id="ctl00_ContentPlaceHolder2_Label1"><p>Sun Bauer was born in the beautiful country of Korea. At an early age, Sun developed a great love and appreciation of art. Using a limited amount of art supplies that were available to her, she developed her art skills as a self-taught artist. During her time in school, Sun entered many competitions and did very well. At the age of 19 she left Korea to live in the United States. She continued to develop her art, and entered in several competitions for the first time within the United States, winning several awards. Sun, eventually, moved to Kansas and got married to Bob Bauer. Together they raised two sons: Daniel, and Tim. Sun has always encouraged her children to express themselves using art. Tim is an English teacher in Korea, and Daniel followed in his mother’s footstep, is very active as an artist and musician, graduated from the Kansas City Art Institute.
</p></span>
        <span id="ctl00_ContentPlaceHolder2_Label2"><p>Sun believes that art is an ongoing and continuous learning experience. In her practice as a growing artist she began to take classes at the Johnson County Community College. There, she worked and studied with many local artists. In an effort to continue her study, Sun has attended several workshops and seminars. She is always taking classes and studying the works of other artists to learn of new techniques in many types of Media. She has taught private classes in her home to share her talents. Although, she is knowledgeable in many types of Media, Sun prefers to work with oils and watercolors. Her work consists of portraits, landscapes, murals, and still life paintings. Sun’s paintings range in size from 3x4–inch miniatures to 30x40–inch wall hangings to full wall murals. Sun has the remarkable ability to look at people, objects, and landscapes and reproduce them within her art, with great beauty. It shows in her Portraits and her commissioned artwork. Recently, Sun has become more interested in working with miniature paintings but she also is still working on normal size art works. She has a true passion for art and it shows.</p></span>
        <span id="ctl00_ContentPlaceHolder2_Label3"><p></p></span>
        <span id="ctl00_ContentPlaceHolder2_Label4"><p> </p></span>
        <span id="ctl00_ContentPlaceHolder2_Label5"><p> </p></span>
    </div>

        </div>
        <div id='footer'>
            <a id="ctl00_HyperLink1" href="Admin/addpictures.aspx">Login</a>
            <span style="margin-left:40px">Future Copyright Info</span>
        </div>
    </div>

<div>

    <input type="hidden" name="__PREVIOUSPAGE" id="__PREVIOUSPAGE" value="tJTCzFVfkJgGp20w36tpLQ2" />
    <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBQLBxYXBDQKG9eWLAgK90NjoBwKC2bvuAgKnqOJzmGwgaud vHWljRFC94SgETv5Y35s=" />
</div></form>
</body>
</html>



CSS:

body {
    font-family: sans-serif;
    margin: 0;
    margin-top:5px;
    padding: 0;
    background: url(site_images/back.jpg) center;
    background-repeat: repeat-y;

}

h1, h6 {
    margin: 0;
    font-weight: normal;
}

div#main {

    width:800px;
    margin-left:auto;
    margin-right:auto;


}


div#container {

    border-left: 2px solid black;
    border-right: 2px solid black;
    border-bottom: 1px solid black;


}

div#header {
    border:2px solid black;
    margin-bottom:5px;
    background:green;
}

div#footer
{
    background:white;
    border-bottom: 2px solid black;
    border-left: 2px solid black;
    border-right: 2px solid black;
    border-top: 1px solid black;
    padding:10px;

}

div#test {
    font: arial;
}

div#aboutbutton {
    border: 2px solid black;
    float:left;
    height:50px;
}

div#addpicturesbutton
{
    border: 2px solid black;
    float:left;
    height:50px;
}

div#addshowbutton
{
    border-top: 2px solid black;
    border-bottom: 2px solid black;
    float:left;
    height:50px;
}

div#addawardsbutton
{
    border: 2px solid black;
    float:left;
    clear:right;
    height:50px;
}

div#exhibitbutton {
    border-top: 2px solid black;
    border-bottom: 2px solid black;
    float:left;
    height:50px;
}

div#awardsbutton {
    border: 2px solid black;
    float:left;
    height:50px;
}

div#artbutton {
    border-top: 2px solid black;
    border-bottom: 2px solid black;
    border-right: 2px solid black;
    float:left;
    height:50px;
}

div#sunpic
{
    margin-top:10px;
    margin-left:10px;
    margin-right:10px;
    border:2px solid black;
    height:351px;
    width:250px;
    float:left;
}

div#abouttext
{
    margin:10px;
    font-family: sans-serif;
}


#login
{
    background:white;
    border-right:2px solid black;
}

.absolute
{
    position: absolute;
    top:50px;
    left:50px;
    background-color: #5795df;
    width: 320px;
    border:double 2px black;
    text-align:center;
}

.MyView
{
    border-color: Blue;
}

.MyView td
{
    border-color: Blue;
}
 
Old August 1st, 2007, 12:03 PM
Friend of Wrox
 
Join Date: Jun 2007
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

Hi!

Ok, this is going to be nasty. Browser compatibility is the worst and trying to debug such a small gap between IE7 and IE6. I hope you've got plenty of hair to spare. You may be pulling some of it out.;)

I LIKE your markup. I can't tell you how many .NET guys I see that let their tools control the code. Not only are you using clean code, it's semantically logical. A very good base for CSS. I think you've got two directions, one is just to tech this. I can't help with that now, because I've only got IE7 here at work. I'll take a look at this when I get home and see what I can see.

In the meantime, here are some of my best CSS tricks. Height is pretty iffy, it doesn't surprise me that you're having fits. It does not work as well as width. I'd recommend playing with margin:auto on some of the header elements. I've been able to fix some of the weirdest problems that way. Another thing to try would be setting all the margins and padding to 0 by default

Code:
* {
    margin: 0;
    padding: 0;
}
I always hate to suggest this retroactively, because then you have to adjust all the other margin and padding that you've already so carefully set up. I always use this in my style sheets though, because different browsers have different defaults. This style rule makes all browsers equal and puts the styling decisions back in your hands, not the browsers. And this could be exactly your problem in this case.

A second approach is to abandon a flow layout and position everything by pixels using position:absolute and top:200px left:10px, etc. etc. You don't necessarily have to redo the entire page, but you'd have to apply it across the entire header. Align everything absolutely (basically lets you set everything manually). Then you need to make sure you've got enough margin so that nothing overlaps between your header which is positioned absolutely and your content which is in the flow.

Hope some of that helps.

-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
 
Old August 1st, 2007, 01:20 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 238
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via MSN to rsearing
Default

Thanks for the reply--actually--I found that answer after MUCH research. I guess it's a bug with images in IE6 in Div's. You can fix it by doing font-size:0 - it removed all my gaps.

Now I have another issue where a margin is magically appearing in 7 and not 6---so I'll trouble shoot that some tonight...sheesh--it is almost taking me as long to make it compatable for IE6 as it did to code the entire site.

:)
Rob

 
Old August 1st, 2007, 05:15 PM
Friend of Wrox
 
Join Date: Jun 2007
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

*narf* well, I'm glad you fixed it. font-size:0 was not something I would have tried anytime soon. Nice catch, I'll have to remember that one.

Yeah, CSS is not a happy technology sometimes. I've not been the most happy with my contact form either. I've seen it recommended to use a list to structure form elements so they maintain some relation even if the style sheet collapses, but it sure makes positioning things and adjusting borders more difficult. Good luck with the margin, tonight. If it's still giving you problems, we'll be here.

-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Line Break Gap / Mozilla Firefox SolarEnergy BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 4 April 15th, 2007 10:20 AM
Small (yet annoying) gap gkirk CSS Cascading Style Sheets 2 June 1st, 2005 04:43 PM
gap in table harpua CSS Cascading Style Sheets 0 April 27th, 2005 09:07 PM
DAL 'stuff' pithhelmet VB Databases Basics 0 November 10th, 2004 04:42 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.