Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create space between float image and text

Tags:

css

Ι want to have 5px space between the image and its description.

enter image description here

I tried margin-left or padding-left but it doesn't do what I want to achieve, it creates the space from the begging of the container. Any idea how I can do that?

#portofolio-element-image{
    width: 128px;
    height: 128px;
    margin-bottom: 5px;
    float:left;
}

#portofolio-element-description{
    color: white;
    text-align:justify;
    margin-left: 5px;
}
like image 965
Avraam Mavridis Avatar asked Mar 24 '14 10:03

Avraam Mavridis


1 Answers

Why not use:

#portofolio-element-image{
  margin-right:5px;
}

Adding a margin to the text will have no effect on the distance between it and the floated image, because the image falls within the text element.

like image 194
SW4 Avatar answered Oct 14 '22 15:10

SW4