Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Div next to image

Tags:

html

css

I'm teaching <div> and i have problem. Div is under image, but I want next to. I tried with setting float, position but nothing help.

Jsfiddle (here divs/images are unconnected!)

How to change it to connect images and form on up?

like image 298
andrzej1_1 Avatar asked Aug 01 '13 08:08

andrzej1_1


2 Answers

Divs automatically create a line break, because they are block elements. Try using display: inline-block on the div.

I updated your fiddle now: http://jsfiddle.net/aqqUV/3/

Note the code change here:

<div class="form" style="
    margin-left: 70px;
    color: white;
    display: inline-block;
">
like image 147
Ferdinand Torggler Avatar answered Oct 27 '22 00:10

Ferdinand Torggler


Just give first image a width and

display:inline-block;
float: left;

and then give these proerties to div following image

display:inline:block;
float:left;
like image 35
Balram Singh Avatar answered Oct 27 '22 01:10

Balram Singh