Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide the background underneath the border

Tags:

I need to modify a website to make the clickable zone of all links bigger for mobile devices. I gave all links a transparent border and a negative margin of the same size, to not affect the text-flow. Now this works like a charm. But not on elements that have a background. The background spreads out to the transparent border. This is behaviour seams to be consistent among all browsers.

http://jsfiddle.net/hq65C/1/ here a other example: http://jsfiddle.net/DytDA/

Why is this? I was always thinking that the border is outside of the element. How could I fix this. (I need a solution that does not require to modify the HTML).

like image 527
meo Avatar asked Sep 19 '11 15:09

meo


People also ask

How do I remove border background?

Remove a border from a picture Select the picture whose border you want to remove. On the Page Layout tab, in the Page Background group, select Page Borders. Click the Borders tab. Under Setting, select None.

How do I remove the bottom border color?

Add a border-bottom-style: none; to your CSS to remove this style from the bottom only.

How do you remove a background border in HTML?

Under Setting, select None. How Do You Remove A Border In Html? Remove the border from an HTML table by setting the CSS property to none. Remove the border from a table if we set the border property to none at HTML table settings.


1 Answers

How about background-clip: padding-box;?

Demo

like image 64
backflip Avatar answered Oct 04 '22 20:10

backflip