Web Develop Forum: Padding issue IE7 / FF - Web Develop Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Padding issue IE7 / FF Rate Topic: -----

#1 User is offline   Jamie Icon

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 79
  • Joined: 18-January 09
  • Gender:Male

Posted 05 February 2009 - 07:52 PM

Hey,

I just wondered if anyone can help, i'm coding for the latest browsers and running into a padding issue where the width of a gap is bigger in between two content areas in FF than it is in IE7.

Here's my code (also if you have any recommendations to better my code, that will also be very helpful!):

HTML
CODE
<div id="contentwrap"> <!-- Start Content Wrapping -->
                
                        <div id="contentmain"> <!-- Start Main Content -->
                        
                                <div id="bluebar">
                                
                                <h1>Main content</h1>
                                
                                </div>
                                
                                <p>Main content area here.</p>
                        
                        </div> <!-- End Main Content -->
                        
                        <div id="rightmain"> <!-- Start Right Content -->
                        
                                <div id="greybar">
                                
                                <h1>Right Content</h1>
                                
                                </div>
                                
                                <ul>
                                
                                <li>Diskspace: 20,000MB</li>
                                <li>Diskspace: 20,000MB</li>
                                <li>Diskspace: 20,000MB</li>
                                <li>Diskspace: 20,000MB</li>
                                <li>Diskspace: 20,000MB</li>
                                
                                </ul>

                        </div>
                
                </div> <!-- End Content Wrapping -->


CSS
CODE
#contentwrap {
    width: 755px;
    margin-top: 5px;
}

#contentmain {
    width: 494px;
    background-color: #FFFFFF;
    border: 1px solid #D8D8D8;
    padding: 2px;
    float: left;
}

#contentmain p {
    text-align: left;
    padding: 5px 0px 5px 5px;
}

#bluebar {
    height: 15px;
    background-color: #103a6b;
    padding: 5px 0px 5px 10px;
}

#bluebar h1 {
    text-align: left;
    font-size: 12px;
    font-weight: normal;
    color: #FFFFFF;
}

#rightmain {
    width: 234px;
    background-color: #FFFFFF;
    border: 1px solid #D8D8D8;
    padding: 2px;
    float: right;
    color: #474747;
}

#rightmain p {
    text-align: left;
    padding: 5px 0px 5px 5px;
}

#rightmain ul {
    float: left;
    padding: 20px 0px 20px 30px;
}

#rightmain ul li {
    padding-bottom: 3px;
}

#greybar {
    height: 15px;
    background-color: #232323;
    padding: 5px 0px 5px 10px;
}

#greybar h1 {
    text-align: left;
    font-size: 12px;
    font-weight: normal;
    color: #FFFFFF;
}


As you can see, i'm not brilliant at coding so if you have any other suggetions feel free to post them!

Thanks,
Jamie
<a href="http://www.learntodesign.net" target="_blank">Learn to design</a> - Photoshop and other webdevelopment tutorials.
<a href="http://www.lucypinderwallpapers.com" target="_blank">Lucy Pinder Wallpapers</a> - Lucy Pinder Gallery
0

#2 User is offline   Tom Icon

  • Member
  • PipPip
  • Group: Members
  • Posts: 25
  • Joined: 01-February 09

Posted 05 February 2009 - 10:27 PM

I had a quick look - just a small suggestion - theres no need to wrap your h1 tags in another div in order to style them...

Also you have 2 h1's, you should swap them for h2's to make them more semantic.
0

#3 User is offline   Diffraction Icon

  • Advanced Member
  • Icon
  • Group: Moderator
  • Posts: 279
  • Joined: 26-January 09
  • Gender:Male
  • Location:USA
  • Interests:Web Development, Reading, Writing, Computers in general...
  • Your specialities (detailed)::HTML 5
    CSS 3
    jQuery

Posted 06 February 2009 - 02:19 AM

Always always always code for firefox first. Then make a conditional statement and attach a stylesheet for IE only to fix the padding issue.
Want to report something to a moderator? Use the 'report' button located on every post.
0

#4 User is offline   styyls Icon

  • Member
  • PipPip
  • Group: Members
  • Posts: 22
  • Joined: 05-February 09
  • Location:Orlando, FL

Posted 06 February 2009 - 06:38 AM

QUOTE (Meshach @ Feb 5 2009, 09:19 PM) <{POST_SNAPBACK}>
Always always always code for firefox first. Then make a conditional statement and attach a stylesheet for IE only to fix the padding issue.

I definitely agree with this one. In addition to this, I would periodically check the site in IE while I'm writing the CSS and HTML to make sure that any larger issues won't come up. (By larger, I mean positioning of elements vs. padding, borders, etc.)

Tom brought up a great point as well. The h1 (and h2, h3, etc.), by default, is displayed as a block level element. This of course means that there is usually a default margin and padding value associated with it.

If you are not familiar with conditional statement in HTML, take a look at this link.

Good luck, Jamie!
My name is Chet. Please refer to me as such. =)
0

#5 User is offline   Will Roberts Icon

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 64
  • Joined: 23-October 08
  • Gender:Male
  • Location:Buckley, North Wales

Posted 06 February 2009 - 11:52 AM

change your css to the following

CODE
#contentwrap {
    width: 755px;
    margin-top: 5px;
}

#contentmain {
    width: 494px;
    background-color: #FFFFFF;
    border: 1px solid #D8D8D8;
    padding: 2px;
    float: left;
}

#contentmain p {
    text-align: left;
    padding: 5px 0px 5px 5px;
}

#bluebar {
    height: 15px;
    background-color: #103a6b;
    padding: 5px 0px 5px 10px;
}

#bluebar h1 {
    text-align: left;
    font-size: 12px;
    font-weight: normal;
    color: #FFFFFF;
    margin: 0px;
    padding: 0px;
}

#rightmain {
    width: 234px;
    background-color: #FFFFFF;
    border: 1px solid #D8D8D8;
    padding: 2px;
    float: right;
    color: #474747;
}

#rightmain p {
    text-align: left;
    padding: 5px 0px 5px 5px;
}

#rightmain ul {
    float: left;
    padding: 20px 0px 20px 30px;
}

#rightmain ul li {
    padding-bottom: 3px;
}

#greybar {
    height: 15px;
    background-color: #232323;
    padding: 5px 0px 5px 10px;
}

#greybar h1 {
    text-align: left;
    font-size: 12px;
    font-weight: normal;
    color: #FFFFFF;
    margin: 0px;
    padding: 0px;
}

My Portfolio: <a href="http://www.imagelimited.co.uk" target="_blank">I.M.A.G.E</a>
Submit Your Site: <a href="http://www.keepittidy.co.uk" target="_blank">K.I.T</a>
CSS & XHTML Tutorials: <a href="http://www.fatbasturd.co.uk" target="_blank">FatBasturd</a>
SEO Services: <a href="http://www.firstplaceingoogle.com" target="_blank">Firstplaceingoogle.com</a>
0

#6 User is offline   pat24 Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 4
  • Joined: 13-February 09

Posted 14 February 2009 - 12:04 PM

Hi

I find its always a good idea to use a reset css sheet. This will as closely as possible give you a standard blank canvas accross all browsers to start with.

In affect what you are doing is removing all the annoying padding and margin differences between browsers.

This is not full proof but will give you a good starting point.

Here is the one I use, it was written by Eric Myers a css guru.

Hope it helps

CODE
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: "" "";
}


Pat
0

#7 User is offline   Sam Granger Icon

  • Administrator
  • PipPipPip
  • Group: Root Admin
  • Posts: 431
  • Joined: 22-October 08
  • Gender:Male

Posted 14 February 2009 - 06:17 PM

What about:

CODE
* {
margin: 0;
padding: 0;
etc...
}

for resetting?
0

#8 User is offline   Diffraction Icon

  • Advanced Member
  • Icon
  • Group: Moderator
  • Posts: 279
  • Joined: 26-January 09
  • Gender:Male
  • Location:USA
  • Interests:Web Development, Reading, Writing, Computers in general...
  • Your specialities (detailed)::HTML 5
    CSS 3
    jQuery

Posted 14 February 2009 - 06:23 PM

QUOTE (Sam Granger @ Feb 14 2009, 11:17 AM) <{POST_SNAPBACK}>
What about:

CODE
* {
margin: 0;
padding: 0;
etc...
}

for resetting?


That is good in most cases but it resets some elements you don't want reset..
Want to report something to a moderator? Use the 'report' button located on every post.
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users