Search
 
SCRIPT & CODE EXAMPLE
 

CSS

text decoration too long

<span style="letter-spacing: 1em; text-decoration: underline;">SPACEEE</span>
<span style="text-decoration: underline;">.</span>
Comment

text decoration too long

h1 {
  /* A nice big spacing so you can see the effect */
  letter-spacing: 1em;
  /* we need relative positioning here so our pseudo element stays within h1's box */
  position: relative;
  /* centring text throws up another issue, which we'll address in a moment */
  text-align: center;
  /* the underline */
  text-decoration: underline;
}

h1:after {
  /* absolute positioning keeps it within h1's relative positioned box, takes it out of the document flow and forces a block-style display */
  position: absolute;
  /* the same width as our letter-spacing property on the h1 element */
  width: 1em;
  /* we need to make sure our 'mask' is tall enough to hide the underline. For my own purpose 200% was enough, but you can play and see what suits you */
  height: 200%;
  /* set the background colour to the same as whatever the background colour is behind your element. I've used a red box here so you can see it on your page before you change the colour ;) */
  background-color: #990000;
  /* give the browser some text to render (if you're familiar with clearing floats like this, you should understand why this is important) */
  content: ".";
  /* hide the dynamic text you've just added off the screen somewhere */
  text-indent: -9999em;
  /* this is the magic part - pull the mask off the left and hide the underline beneath */
  margin-left: -1em;
}

<h1>My letter-spaced, underlined element!</h1>
Comment

PREVIOUS NEXT
Code Example
Css :: overriding fullpage js anchor style 
Css :: how to make sure your css files are connected on ruby on rails 
Css :: many className module css 
Css :: acrilic css 1 
Css :: grape change status code 
Css :: Styles for Facebook Feed Smash Balloons 
Css :: The edit queue is full at the moment - try again in a few minutes! 
Css :: css geight 
Css :: how to add selector to another selector in css 
Css :: countload on pageloading in html css 
Css :: responsive text size 
Css :: empty rulesets css 
Css :: css ul shifts 
Css :: nokogiri xml diff 
Css :: which bootstrap css class will you use to put the navbar at the top of the page? feel free to check out the bootstrap website. 
Css :: bouton darkmode 
Css :: target only mozilla css 
Css :: when else 
Css :: css different rules on different devices 
Css :: ipad css media query 
Css :: SPECIFIC CHILD ELEMENTS 
Css :: How to disable phone number linking in Mobile Safari 
Css :: alternate color on two consecutive rows 
Css :: color: inherit; 
Css :: css tricks 
Css :: how to style a particular image in css 
Typescript :: req.user typescript 
Typescript :: vscode change comments color 
Typescript :: javax.validation.constraints does not exist 
Typescript :: rename table of contents latex 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =