Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Apr 2014
    Posts
    7
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Troubles with CSS

    Hi,

    So I've taken some advise from a previous post and started to validate my HTML. One error I've got is -

    Line 118, Column 40: The width attribute on the table element is obsolete. Use CSS instead.
    <table class='phototable'; width="100%">

    This currently displays a small table I have in the centre of the page and displays at 100% my html screen design.

    Now the my issue is that if I go to my CSS and put in there the table width, the table now displays at the left of my screen design and does not display at 100% of my screen design width.

    Any ideas what might be the issue here?

    I've tested all my pages and I've highlighted a fair few errors that I'm now going to spend my time going back and rectifying, so I might be coming back and forth with questions.

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,676
    Thanks
    6
    Thanked 1,008 Times in 981 Posts
    There is a redundant semicolon in the line of HTML you posted, that shouldn’t be there.

    That said, what exactly have you written in your CSS now? We aren’t psychic, you know?

  • #3
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,205
    Thanks
    23
    Thanked 605 Times in 604 Posts
    Somewhere along the line you have code after the width="100%" was inserted that changes it. The last setting of a rule takes presidence. First question would be, did you add the rule to table{} or .phototable{}? I'd look at both of them.
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."

  • #4
    New to the CF scene
    Join Date
    Apr 2014
    Posts
    7
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Sorry forgot to add the CSS coding -

    Code:
    .phototable {
    background: #000000;
    table border= "0";
    cellspacing= "2";
    cellpadding= "2";
    align= "center";
    width= "100%";
    border: 3px solid #ffffff;
    padding:10px;
    -moz-border-radius: 10px;
    -webkit-border-radius: 10px;
    border-radius: 10px;
    }

  • #5
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,205
    Thanks
    23
    Thanked 605 Times in 604 Posts
    All of this
    table border= "0";
    cellspacing= "2";
    cellpadding= "2";
    align= "center";
    width= "100%";

    is bogus

    See this CSS Styling Tables
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."

  • #6
    Regular Coder COBOLdinosaur's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    404
    Thanks
    2
    Thanked 32 Times in 32 Posts
    You also will not get the table centered using alignment properties, that aligns the content of the table, not the table.

    to center the table in the page you need to use margin:auto ... though with a width of 100% there are no margins.

    Iy appears that you are not very familar with CSS, so it might be a good idea to post a link so we can see the interactions and use diagnostic tools if necessary to help you.
    100% standards compliant code is 100% correct 100% of the time.
    one of my toys from my repository and perhaps some help getting help

    Cd&


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •