Positioning text on the right side of an image with css

Discussion in 'CSS' started by Bradley Pink, Mar 7, 2013.

  1. #1
    I'm green, and i'm stooped.

    I have a picture on the left with alot of white space on the right, and would like to add a header and a couple of paragraphs there.

    What should i use to move it around vertically and horizontally.
    Appreciate the help :D
     
    Bradley Pink, Mar 7, 2013 IP
  2. Isak Hejnesen

    Isak Hejnesen Greenhorn

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #2
    Well the basic rules you would want to use are Margin, padding and float.
     
    Isak Hejnesen, Mar 8, 2013 IP
  3. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #3
    Isak is right, what you're looking for is to float the image -- but without seeing the code, content and image, we really can't tell you a whole lot more than that.
     
    deathshadow, Mar 8, 2013 IP
  4. AlbCoder

    AlbCoder Well-Known Member

    Messages:
    126
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    163
    #4
    This tutorial will help you http://www.kavoir.com/2009/02/css-text-over-image.html
     
    AlbCoder, Mar 8, 2013 IP
  5. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #5
    I believe the OP was asking for next to, not over.

    NOT that placing text over a image that way is EVER a good idea given how it pisses on the texts legibility, prevents the use of dynamic size and/or results in broken layouts, etc, etc... Particularly bad being removing text from flow with the APO -- at the very least that should either be done as a background-image (since in that case it doesn't look like content and as such has NO business in a IMG tag) or with a negative margin so the text remains in flow.
     
    deathshadow, Mar 8, 2013 IP
  6. creativewebmaster

    creativewebmaster Active Member

    Messages:
    654
    Likes Received:
    7
    Best Answers:
    4
    Trophy Points:
    78
    #6
    Here are the guideline how to put header and content beside the left image.

    First create one class as below and put the CSS in .style file.
    img
    {
    float:left; padding: 0 15px 15px 0px;
    }

    Now beside the left image please put your header image and content.
     
    creativewebmaster, Mar 8, 2013 IP
  7. dlb

    dlb Member

    Messages:
    203
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    35
    #7


    <div class="image-wrap">
    <img src="YOUR-IMAGE.png" alt="Alternative text" />
    <div class="image-meta">
    <p class="image-title">Image Title</p>
    <p>Text about the image</p>
    </div>
    </div>

    and the CSS...

    .image-wrap {
    display:inline-block;
    }

    .image-wrap img {
    float:left;
    }

    .image-meta {
    float:right;
    }

    .image-title {
    font-weight:bold;
    }

    You may need to play around by adding width's to ".image-wrap img" and ".image-meta", but this solution is the best I can do without actually seeing your code.
     
    Last edited: Mar 14, 2013
    dlb, Mar 14, 2013 IP