Mix the anchor underline style with the inline element

I noticed that if an element, such as span or p, has an inline block display, then it will cover the anchor underline style when it is placed inside.

<a href="http://www.stackoverflow.com"><span style="display:inline-block">test</span></a> <a href="http://www.stackoverflow.com"><p style="display:inline-block">test</p></a> 

Is there any way to prevent this?

+4
source share
3 answers

add text-decoration:inherit; to the style tag text-decoration:inherit;

+1
source

1) Move the style to the tag

 <a href="http://www.stackoverflow.com" style="display:inline-block">test</a> 

or

2) Add an underline to the child

 <a href="http://www.stackoverflow.com"><p style="display:inline-block;text-decoration:underline">test</p></a> 
+1
source

Add the following style:

 ​a *:hover { text-decoration: underline }​ 

Demo

0
source

Source: https://habr.com/ru/post/1439890/


All Articles