Log in

View Full Version : How to resize the image in order to fit the parent div



meomeoconmeo
06-12-2017, 07:45 AM
Hi. I want to ask about resize image. I use image by before pseudo

h2::before {
content: url("image.png")
}
But the image is bigger than its parent div tag. And if i use the

autoflow:auto;
then a scrollbar appears . I tried resize image by using width and height but nothing happens.

coothead
06-12-2017, 06:12 PM
Hi there meomeoconmeo,


and a warm welcome to these forums. ;)

I would suggest that you try it like this...




<style media="screen">
h2 {
background-image: url(image.png);
background-size: auto 100%;
background-repeat: no-repeat;
text-indent: 2em; /* adust this value to suit */
}
</style>

If you do not want the "background-image" to be 100% of the "h2 element's"
height then you may need to use "background-position" values as well.


coothead