Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS How to place a image on the same line as text

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #248081
    johned
    Participant

    I am trying to place a image on the same line as the text. I want to place the image on the right. I have tried float: right; but that does not work. I have attached the code below. How can I make the image line up on the right hand side rather than falling below the text?
    http://codepen.io/Johned22/pen/NbpPJJ

    Thanks in advance

    #248083
    I.m.learning
    Participant

    Use :after

    This is my code I used. Just change what you need.

    CSS:

    h2:after{display:inline-block;width:25px;height:25px;content:” “;background:url(YOUR_URL_HERE);background-size:100%;margin:10px 10px 0 5px!important;vertical-align:bottom;}

    #248084
    I.m.learning
    Participant

    oops, internet loading issues…

    I could have just stated to use the :after, but since I cannot delete this, I might as well use it to explain that I gave you my code because it worked for me and who knows if you won’t have more issues. Might as well just give you the entire code and let you have at it.

    If anyone sees an error in this, they might as well say so because this is what I’m using and might as well get an opinion about it while I’m here. As in my name, I am still learning.

    #248094
    Beverleyh
    Participant

    Not sure what you mean. The image is currently to the right of the text.

    Are you asking about vertical-alignment? As in, the relationship between the text and the image? Maybe this will help https://css-tricks.com/almanac/properties/v/vertical-align/

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘CSS’ is closed to new topics and replies.