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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jul 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problem with Center Attribute and Bgcolor Attribute

    When I try and center an image or Input field it will remain left justified, why does this happen? The align="left" and the align="right" both work but center does not.
    Also, How do you use bgcolor properly? I have in a bit of code: <h2 align="left" bgcolor="red">Left aligned heading</h2> But the color red does not appear behind the text. How do you use the attribute bgcolor the correct way? Any help would be greatly appreciated. Thanks.

  • #2
    Regular Coder Jutlander's Avatar
    Join Date
    Jun 2007
    Location
    In my own sick little world :P
    Posts
    425
    Thanks
    1
    Thanked 12 Times in 12 Posts
    You don't use the bgcolor attribute at all, use CSS instead. Like this:

    Code:
    <style type="text/css">
    h2 {
    background: #f00;
    color: #000;
    }
    </style>
    That goes between <head> and </head>.

    As to your centering issue. Try wrapping everything in a class which you call "center". Like this:

    Code:
    .center {
    margin: 0 auto;
    width: 400px;
    }
    Doesn't necessarily have to be 400 px just an example.
    Last edited by Jutlander; 07-08-2007 at 01:13 AM.
    .
    .

  • #3
    New to the CF scene
    Join Date
    Jul 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks that clears up the issue.


  •  

    Posting Permissions

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