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
  • #248081

    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?

    Thanks in advance


    Use :after

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


    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;}


    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.


    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

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