Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

HTML header problem

  • 13-08-2012 08:22PM
    #1
    Registered Users, Registered Users 2 Posts: 1,559 ✭✭✭


    Hi I'm trying to create a basic webpage using html and css.
    I have created a basic header bar using a red background and blue text but the problem is when I use a heading for the text ie. h1 there is a white space left above the bar.
    Whats the best way of getting rid of the space above the bar?
    I want it to look the same in all the browsers.


Comments

  • Closed Accounts Posts: 2,663 ✭✭✭Cork24


    Can you post your Code?

    More Likely you have the CSS colour System all fecked up.



    #header h1 a{
    font-weight:100;
    color: blue;
    text-decoration: none;
    }


  • Registered Users, Registered Users 2 Posts: 25 Marty_McFly


    Lob into this yolk :)

    http://jsfiddle.net/


  • Registered Users, Registered Users 2 Posts: 1,559 ✭✭✭quinnd6


    #header
    {
    
    margin-top:0;
    padding-top:0;
    background-color:red;
    text-align:center;
    color:blue;
    }
    
    body
    {
    margin:0;
    padding:0;
    
    }
    


  • Closed Accounts Posts: 2,663 ✭✭✭Cork24


    quinnd6 wrote: »
    #header
    {
    
    margin-top:0;
    padding-top:0;
    background-color:red;
    text-align:center;
    color:blue;
    }
    
    body
    {
    margin:0;
    padding:0;
    
    }
    

    Your Back Ground Color should be in the Body, or in the CSS of your DIV.


  • Registered Users, Registered Users 2 Posts: 1,559 ✭✭✭quinnd6


    It's in the css of my header div though isn't it.
    I haven't decided on the background color for the body yet.
    So its just white at the moment.
    I read somewhere about using padding with negative numbers.
    Would that be a bad idea?


  • Advertisement
  • Closed Accounts Posts: 2,663 ✭✭✭Cork24


    By all means you could Use a Table as your layout



    <div id="Header" name="Header" title="This is my Header" style="color:Red;
    font: Helvetica 12pt;border: 1px solid black;">
    <h1>Header</h1>
    </div>


    http://www.w3schools.com/ This site gives you every thing you need to know.

    i would Say to you is Download Some Website Demos see what you like in each site and try and take all the parts you like in each Demo Site and place them into your Basic Webpage..
    Alot of Companys use the Same layout all the time, just change it around to meet the clients Needs.


  • Registered Users, Registered Users 2 Posts: 1,559 ✭✭✭quinnd6


    Yep I think the problem was I wasn't using float:left.
    Using float:left fixed it anyway for me.


Advertisement