Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

padding divs with images by css selection

my html code looks like that

<div class="div1">
    <span class="sp1"></span>
    <span class="sp2"></span>
    <img class="img1" src="sss.png">
    <a class="a1" href="test.aspx">aaaa</a>
    </img>
</div>

the code contains also few more boxes just without the image, does css can padding the boxes which contains an img tag

like in this css

.div1 > img {
    padding: 1px 0px 5px 0 !important;
    margin: 0;
}

but this css padd the image , and i want to padding the div

like image 663
roy.d Avatar asked Nov 10 '22 16:11

roy.d


1 Answers

you can give a common class name to all the div containing images and pad the div by taking only .imageContainer class

like this

.imageContainer{
    padding: 1px 0px 5px 0;
    margin: 0;
}
like image 77
Sid M Avatar answered Nov 15 '22 04:11

Sid M