jojo
jojo

Reputation: 13863

css issue when display background image in a element

i got a issue, let say i want to display a background image for a link

                  |   words   |

the bars mean the start/end of the link, it doesn`t actually exist

and i want the background image display horizontally, but not start from the bar, and end at the bar,

i want it start 13px away from the left bar and 13px away from the right bar??

i know there is a background-position in css, but can i ask the background-position to specify the 13px for me???

Upvotes: 0

Views: 209

Answers (2)

Anax
Anax

Reputation: 9372

The following code does what you need:

<style>
    .biglink {
        margin: 0 13px 0 13px;
        background: url('background.png') no-repeat center center;
    }
</style>

Upvotes: 1

psychotik
psychotik

Reputation: 39029

I believe background obeys the padding and margin css styles, so you could set margin-left: 13px; and margin-right: 13px;.

Upvotes: 0

Related Questions