www.webdeveloper.com
Results 1 to 4 of 4

Thread: css wont move image, but the html does.

  1. #1
    Join Date
    Apr 2012
    Posts
    110

    css wont move image, but the html does.

    Hi, Im trying to put my second image on the right side. The css, doesnt matter what alterations I do, it has no effect, but the html, when I put img src in under the body tag, then it moves to the right, if I put align:right in.
    The css now is #webtheme.jpg2
    {
    position:absolute;top:10px;left:700px;
    width:155px;margin:30px;auto;
    height:317px;
    background-image:url('webtheme.jpg2');
    background-position:right top;
    background-repeat:no-repeat;
    align:right;
    }
    html code is under the <body>
    <img src="images/webtheme.jpg2 width="155" height="317" alt="" title="webtheme.jpg2" border="0" align="right"/>

    I just put the align:right in the css to see if it would work then. Also tried taking align right out the html and leaving the align right in the css.
    Also tried the other way, putting the width, height, border, background-image,background-position, background-color, background-size, background-repeat, in those orders in the css. The css just wont work. Ive got this image in coffee cup editor. It puts the image in the page, but in the wrong place, so I try deleting it, putting my own code in. Also the coffee cup puts the image in with just the html code: <img src= etc, etc.> then the a href.
    But it doesnt put the css in. Only put the css in for the first image, which it put under .body { etc, etc, in the css. Ive given this <img id="webtheme.jpg2"/> under the <body> in html.

  2. #2
    Join Date
    Feb 2012
    Location
    Bokaro Steel City (Jharkhand), India!
    Posts
    194
    align is a deprecated attribute of html.
    From now onwards, consider not using it to comply with the standards!

    But as the browsers still support it, you got it working in html.
    Also CSS does not understand it (...because this property does not belong to CSS).

    Use the float property in CSS to align the image!

    To learn about float, check this: CSS Floating
    Last edited by TheAliveWinner; 04-30-2012 at 11:56 PM. Reason: I love water!
    "It will never rain roses: when we want to have more roses, we must plant more roses." - George Eliot

  3. #3
    Join Date
    Feb 2012
    Location
    Bokaro Steel City (Jharkhand), India!
    Posts
    194
    Try this:
    HTML Code:
    #webtheme.jpg2 {
        position: absolute;
        top: 10px;
        left: 700px;
        width:155px;
        margin: 30px auto;
        height: 317px;
        background-image: url('webtheme.jpg2');
        background-position: right top;
        background-repeat: no-repeat;
    
        float: left;
    }
    Does this work?
    Reply to me if it doesn't because I have just edited your code!

    I have not tried to debug it in any browser!
    Last edited by TheAliveWinner; 05-01-2012 at 12:03 AM. Reason: I hate beer!

  4. #4
    Join Date
    Apr 2012
    Posts
    110

    thanks Alive winner, Ill try that out.

    I was just wondering, maybe it wont work, cause I dont put any <a href> code in anywhere, is this essential, Im using coffecup. editor.
    thanks

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles