How do I vertically align multiple text next to an image with CSS?


Tags: html,css

Problem :

I have the following code:

<div style="width: 150px">  
<div style="padding: 5px">
   <img src="http://xenforomods.info/styles/Silent/xenforo/browser/announcementIcon.png" width="50px" style="vertical-align:middle">
    <span style="font-size:10px;">Some text here jasjsjsjsjsjjsjsjsjsjsjsjs</span>
</div>      
</div>

http://jsfiddle.net/2rAGf/

Which shows an image like:

enter image description here

How can I center multiple lines next to this image, so that this jasj.... does not go down the image.



Solution :

check this link

Give float:left style for image tag

http://jsfiddle.net/2rAGf/12/


    CSS Howto..

    how to clear all css styles

    How to fix the height of this div

    How do I disable position:fixed in web pages?

    How to manually override CSS @media queries?

    How to make a background header image extend to full width of browser

    How to bundle Angular 2 component css?

    How does ASP.NET generate HTML?

    How to have “onmouseover” highlight in css?

    How to locate Element via CSS Selector/XPath?

    How to extract icon from picture and display it in page? (by javascript or jquery or css)

    CSS how to vertical align div in a div against a sibling div (inline-block)

    How to change the width of an HTML upload field with CSS?

    How do I set two values for IE's `filter` property?

    Span tag is shown as text in Drupal Bootstrap subtheme

    how to style a symfony2 form button

    How to embed fonts in CSS?

    How to get page content to stretch and stick footer to bottom of page?

    How to quickly create complex web controls for web development? [closed]

    How to enlarge an image horizontally in css?

    How to divide a menu horizontaly between buttons , using CSS?

    How can I make a div horizontally center itself in another div? [duplicate]

    How to wrap text around image?

    How to convert css margin value to pixels with just plain javascript?

    How to dynamically allocate block of text using css?

    How to target and style specific elements using CSS

    How can I center my

    when there is an next to it?

    How to change the css of a div using the click function on jQuery, but however twice instead of once?

    How can I overlay a canvas over a paragraph so that its title is shown when hovering over its entirety?

    How do I align an inner div with the bottom of an outer div?

    How to use calc in CSS for mozilla firefox without position absolute