Created
August 22, 2012 12:16
-
-
Save jpsirois/3425015 to your computer and use it in GitHub Desktop.
CSS :before without getting the text-decoration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
margin: 2em; | |
} | |
a { | |
display: inline-block; | |
margin-bottom: 1em; | |
position: relative; | |
border-bottom: 1px solid black; | |
text-decoration: none; | |
} | |
a:before { | |
content: "»"; | |
color: black; | |
padding: 0 .25em; | |
} | |
a.no-before-border:before { | |
left: -1em; | |
position: absolute; | |
text-decoration: none; | |
padding-bottom: 10px; | |
background-color: white; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>CSS :before without getting the text-decoration</title> | |
</head> | |
<body> | |
<a href="http://google.com">:before got the border</a> | |
<br /> | |
<a href="http://duckduckgo.com" class="no-before-border">:before did’nt get the border</a> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CSS :before without getting the text-decoration | |
authors: | |
- Jean-Philippe Sirois |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Live example : http://3425015.run-a-gist.herokuapp.com/