Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Padding not working in anchor [closed]

My text inside anchor is not taking padding, but padding applies when it's hovered. That's why on hover my web structure is just moving. Please help.

like image 407
hussain nayani Avatar asked Sep 05 '14 07:09

hussain nayani


People also ask

How do you prevent anchors from scrolling behind a sticky header?

You could add the scroll-padding-top CSS property to an HTML element with a value of 4rem . Now when you click the anchor link, the browser jumps to the anchor section but leaves padding of 4rem at the top, rather than scrolling the anchor point all the way to the top.

How do you anchor a header in HTML?

To add an anchor to a heading in HTML, add a <section> element with an id attribute. Don't use <a name> . Use lowercase for id values, and put hyphens between words. To add an anchor to a heading in Markdown, add the following code to the end of the line that the heading is on.


1 Answers

Anchor links (a elements) are inline elements, they can't have paddings. Making them inline-block must work.

Just add:

a
{
    display:inline-block;
}
like image 138
MoonDev Avatar answered Sep 18 '22 09:09

MoonDev