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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jun 2013
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    [CODE] very simple HTML/CSS code help [CODE]

    [CODE]
    hey! i am very very new to Css and HTML and i have already run into so many issues, here is my first
    [CODE]
    <html>

    <body>
    <body background="Webbackground.jpg">

    <dev style="margin-left: auto; margin-right: auto;">

    <img src="textbloc.jpg">
    </dev>

    </body>

    </html>
    [CODE]

    I have no clue why the image "textbloc.jpg" will not center on the webpage

    http://cryptic.gaming.multiplay.co.uk

    ^^^^^^^^^^^^^^^^^ where you can see this code in action

    Thanks for any help!

    [CODE]

  • #2
    New Coder
    Join Date
    Jul 2012
    Posts
    10
    Thanks
    3
    Thanked 1 Time in 1 Post
    Code:
    <html>
    <body>
    <body background="Webbackground.jpg"> 
    <dev style="margin-left: auto; margin-right: auto;">
    <center>
    <img src="textbloc.jpg">
    </center>
    </dev>
    </body>
    </html>

  • Users who have thanked wingsgb for this post:

    punchline (06-06-2013)

  • #3
    Senior Coder
    Join Date
    Feb 2009
    Location
    Ilkley, West Yorkshire, UK
    Posts
    2,956
    Thanks
    9
    Thanked 727 Times in 721 Posts
    wingsgb - the center tag is deprecated and should no longer be used.

    punchline - an img is an inline element, and so can be centred by using text-align:center. You can set this on the enclosing h1 element here. It looks like you may have attempted to centre the element using margin:auto. This will work on a block level element if that element has a declared width. (Info on inline and block elements here).

    There are a number of other problems with your code, however, which are likely to cause problems later. Use the W3C validator to find these, and check as you go along (see link in my sig). Most importantly, your code does not have a valid doctype.
    Last edited by SB65; 06-06-2013 at 08:23 AM.
    Use the W3C HTML Validator and CSS Validator to check your code and Firebug to see what css is applied to an element
    Read Steve Krug's book Don't Make Me Think - essential reading on web usability
    I don't recommend much, but I do recommend Clook for UK web hosting

  • #4
    New to the CF scene
    Join Date
    Jun 2013
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks guys, really helped and expect me back here for the next issue!


  •  

    Tags for this Thread

    Posting Permissions

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