Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to shift a background image with css

I wanted to put a border around a table which has a background image. The border works fine, but when I do this (it is an 8px border) the background image gets cut off by the border. Am I able to shift the background image to start 8px to the right and 8px down?

like image 550
Ankur Avatar asked Jul 24 '09 02:07

Ankur


People also ask

Can you transition a background image in CSS?

First, we add a transparent background image using the background-image property in CSS in the style tag. background-image: url(white. jpg); For the transition background image, we use the transition property in CSS and add a transition to the background image in the style tag.

What is background-position in CSS?

The background-position CSS property sets the initial position for each background image. The position is relative to the position layer set by background-origin .


1 Answers

You can use the background-position:

background-position: 8px 8px; 

More on that: https://developer.mozilla.org/en-US/docs/Web/CSS/background-position

like image 161
Nathan Avatar answered Oct 03 '22 06:10

Nathan