I have a div, which I have given a border on top. The border needs to be shifted one pixel higher. Is this possible with CSS.
For example, if you have have a 2px left border and want it to appear as an inner border, you can just offset the whole container to the right, like this: position: relative; left: 2px; You might have to do other corrections, such as reducing the width of the container by 2px .
Answer: Use the CSS box-shadow property If you want to place or draw the borders inside of a rectangular box there is a very simple solution — just use the CSS outline property instead of border and move it inside of the element's box using the CSS3 outline-offset property with a negative value.
If you want to set a border to just one side of the element, use four values (write none to the side you want no border to appear). If you want to set a border to the top and bottom sides, use two values (write none to the second value).
You can accomplish this with a negative top margin
{ margin-top: -1px; }
very basic example: http://jsfiddle.net/zW6yD/
You can do
div { position: relative; margin-top: -1px; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With