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 2 of 2
  1. #1
    New Coder
    Join Date
    Feb 2007
    Posts
    92
    Thanks
    1
    Thanked 0 Times in 0 Posts

    HTML Ezine / Newsletter

    Hi

    I have created an ezine that i want to send out. It seems to be centered when viewed on a desktop. But when i view it on my mobile it is completely to the left. I want it to look centered across all platforms.

    How do i do this?

    I have attached html and css files
    Attached Files Attached Files

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,745
    Thanks
    22
    Thanked 1,838 Times in 1,822 Posts
    Hello bunny1,
    Your use of deprecated <center> tag may be the cause of your problem. That's been gone since HTML4.01 and should not be used anymore.

    To center an element you need three things:
    1. a valid DocType
    2. an element with a width
    3. that elements right/left margins set to auto



    You also float all divs left. I have a pet peeve about floating full width elements as floating is for putting two elements beside each other. I would recommend not using this bit -
    Code:
    div {
        color: #FFFFFF;
        float: left;
    }
    You should validate both your markup and your CSS. See the links about validation in my signature line below.


    .
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad


  •  

    Posting Permissions

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