Multiple lines of text next to image (CSS-HTML)

align text next to image html
image and text side by side html css
vertical-align text next to image
html force text below image
css image next to text vertical align
text after image css
how to put text next to an image in css
line up image with text

I am trying to put 2 lines of text next to an image, sort of like this

_________
|       | Line one of text
| image |
|       | Line two of text
---------

This is the code that I have so far

<p style="color: #fff;"><img src="assets/image.png"><span style="">Line one of text</span>
    <br>
    <span class="ban2">Line 2 of text</span></p>
 .banner p {
  font-family: "Gentium Basic";
  font-size: 19px;
  text-align: center;
  color: #aaa;
  margin-top: -10;
  display: block;
 }
.banner img {
  float: center; 
    margin: 5px;
 }
 .banner span {
  padding-top: 50px;
  font-size: 17px;
  vertical-align:top;
 }
  .banner .ban2 span {
  padding-top: 50px;
  font-size: 17px;
  vertical-align:top;
 }

But currently it does this:

_________
|       | Line one of text
| image |
|       | 
---------
Line two of text

I have looked all over the web but have not been able to figure out how to do this, any help would be very welcome.

There's no such thing as float: center; You can choose either left, right, or none.

http://jsfiddle.net/vd7X8/1/

If you float: left; on the image it will do what you're after.

If you want it centered, then you're going to have to wrap the image and the text in a container, fix the width of the container and do margin: 0 auto; on it, then continue to have your image floated--except it will be constrained by the wrapper.

Multiple lines of text next to image (CSS-HTML), Multiple lines of text next to image (CSS-HTML) - html. I am trying to put 2 lines of text next to an image, sort of like this ______ | | Line one of text | image  How to Put Text Next to an Image and Centre ("Center") Both on a Web Page (HTML/CSS) by Christopher Heng, thesitewizard.com I was asked by a visitor how he could place text beside an image and group them so that he could treat them as a unit, to centre ("center" if you use a different variant of English) or otherwise position them on a web page.

Here is a snippet using a svg so you can test it anywhere.

.img{
    float: left;
    margin-right:1rem;
}
<div>
  <svg class="img" width="50" height="50" >
    <rect width="50" height="50" style="fill:black;"/>
  </svg>
  <p>
    Line 1
    <br>
    Line 2
  </p>
</div>

DIV That is multiline text next to images, jpg) float "left" and second image(logo2.jpg) float "right". Hope it helps you out Laughing. css. Multiple lines of text next to image(CSS-HTML) (3) I am trying to put 2 lines of text next to an image, sort of like this _____ | | Line one of text | image | | | Line two of text ----- This is the code that I have so far

Here is my demo which have using float and overflow with some explain

.div1 {
     border: 3px solid #0f0;
     overflow:auto; // without overflow here, if the "Line 1" and "Line 2" is short then "Next elements" will display below "Line 2" and the image will cover the "Next elements" 
}
.img {
    float: left;
    width:100px;
    height:100px;
    background: #000 
}
.div2 {
    float: left; // without float here, if "Line 1" and "Line 2" is long -> text will display both at right and bottom the image
} 
<div class="div1">
  <img class="img"/>
  <div class="div2">
    <p> Line 1 </p>
    <p> Line 2 </p>
  </div>
</div>

<p>Next elements</p>

Vertically align text next to an image, Board index Web Development HTML - CSS I have the following html code. I try to center vertically a text next to an image, both into a Div. And, if you want to have multiple lines of text centered vertically next to image, add the text into a  By default an image will be placed on the text baseline. All you are doing is moving where the image is attached relative to the text. As for using float:left, you should be doing that either on the block that contains the image and text, or on the text itself. – jamesrom Dec 7 '11 at 0:57

I know this post is old but wrap your element in a div and apply the vertical-align:top to this div and you're done.

Multi-Line Padded Text, I guess what better place to address it than CSS-Tricks eh? The situation involves ragged-right inline text. Like when a paragraph of text breaks to the next line  Optionally, you could add media queries to make the images stack on top of each other instead of floating next to each other, on a specific screen width. The following example will stack the images vertically on screens that are 500px wide or less:

Check it. It is well defined css.

<!DOCTYPE html>
<html>
   <head>
      <title>Selectors</title>
      <style>
         .banner p {
             font-family: "Gentium Basic";
             font-size: 19px;
             text-align: center;
             color: #aaa;
             margin-top: -10;
             display: block;
         }
         img, span {
             float:left;
         }
         .banner img {
             float: center; 
             margin: 5px;
         }
         [class="ban1"]{
             font-size: 17px;
             position:relative;
             top:50px;
             left:11px;
         }
         [class="ban2"] {
             font-size: 17px;
             position: relative;
             left: -97px;
             top: 74px;
         }
      </style>
   </head>
   <body>
      <div class="banner">
         <div class="wrapper">
            <p><img src="span.png"><span class="ban1">Line one of text</span>
               <span class="ban2">Line 2 of text</span>
            </p>
         </div>
      </div>
   </body>
</html>

Vertically Center Multi-Lined Text, If you only have a single word or a single line of text, there is a clever way to vertically center it in a block with CSS. want text to be centered both horizontally and vertically and be adaptable to multiple lines. The HTML is nothing fancy. images/abe-bg.png) no-repeat; position: relative; } .bubble { position: absolute; left:  I want the text and the image to be next to each other but I want the image to be on the far left of the screen and I want the text to be on the far right of the screen. This is what I currently ha

Place two lines of text next to logo - HTML & CSS, This is embarrassing, but what is the correct way to place two lines of text next to a photo/image? The masthead for the website I'm working on  I'm doing a site in which images need to presented next to textual content - a sort of pseudo two-column layout, as the images and text come from a single html source. I've found quite a simple way to do this by putting the images as their own paragraphs and floating them.

Vertically aligning text next to an image - HTML & CSS, I'm specifying the line height of the text to be the same as the <li> (as shown in this tutorial Vertical align for navigation lists with multiple … As already stated in the accepted answer use the following: word-break:break-all; The W3 specification that talks about these seem to suggest that word-break: break-all is for requiring a particular behaviour with CJK (Chinese, Japanese, and Korean) text, whereas word-wrap: break-word is the more general, non-CJK-aware, behaviour.

CSS text-align-last property, CSS text-align-last Property. ❮ Previous Complete CSS Reference Next ❯. Example. Align the last line of text in three  HTML Paragraphs. The HTML <p> element defines a paragraph.. A paragraph always starts on a new line, and browsers automatically add some white space (a margin) before and after a paragraph.

Comments
  • I am trying to center the image and text in a banner, if I make it float to the left then it goes all the way to the left without allowing me to make it centered.
  • If you want it centered, then you're going to have to wrap the image and the text in a container, fix the width of the container and do margin: 0 auto; on it, then continue to have your image floated--except it will be constrained by the wrapper. See this: jsfiddle.net/vd7X8/1 (also updated answer.)
  • Yep, with some workaround that could be usable solution. Btw, post age doesn't matter, Q&A are here to provide help to other people too (facing same or similar problems).
  • This says float: center; that's not possible in css