Home > Software engineering >  CSS: How to give space between backgorund-image and text (with the given properties)?
CSS: How to give space between backgorund-image and text (with the given properties)?

Time:10-08

I'm learning CSS and I have an assignment where I'm given 12 properties and I need to create this button...

These are the properties given to me.

The button I need to create.

This is how my button looks like.

My code.

I tried everything but I couldn't give a space between the image and the text... help me :(

CodePudding user response:

What you need to set here is your padding-left and set your background-position-y to either 0px or left;

padding is a shortcut for padding-left , padding-top, padding-right, padding-bottom

You can do your padding as either padding: 15px 15px 15px 50px; this will make it 15px and padding-left: 50px;

or you can make it

padding: 15px;
padding-left: 50px;

in this specific order

  • Related