How do I make CSS arrow the same width as the container? - html

I currently have arrows below the containers as shown in this fiddle: https://jsfiddle.net/xo9vwks1/
HTML:
<ul class="arrows">
<li><div>sadf sdfsdsdf</div></li>
<li><div>sdsa sdss sdsd s </div></li>
<li><div>sdfsdf sad assdssds s sdsdds sn</div></li>
<li><div>sdsd sadfsdf asdf sadfon</div></li>
<li><div>sdf sdfsdf sss ssdss ss s asd sa gsdsdf</div></li>
</ul>
CSS:
ul.arrows li {
background-color: #ddd !important;
display: block;
margin-bottom: 40px !important;
padding: 0 10px !important;
text-align: center;
list-style: none;
max-width: 400px;
}
ul.arrows li div::after {
border-color: #ddd transparent transparent;
border-style: solid;
border-width: 30px;
content: " ";
height: 0;
position: absolute;
right: 0;
left: 50%;
top: 100%;
width: 0;
z-index: 10;
margin-left: -30px;
}
ul.arrows li:last-child div::after {
border-width: 0;
}
ul.arrows li div {
display: inline-block;
line-height: normal;
padding: 15px 0;
position: relative;
}
I would like to have the arrows extend all the way from left to right so that they are equal to the width of the container like shown in the image below. The arrows must also be responsive. I couldn't work it out. How do I do this?

CSS linear-gradient is one way to do it, if you're only looking to support newer-ish browsers:
ul.arrows li {
background-color: #ddd !important;
display: block;
margin-bottom: 40px !important;
text-align: center;
list-style: none;
max-width: 400px;
}
ul.arrows li div {
line-height: normal;
padding: 15px 10px;
position: relative;
}
ul.arrows li div::before {
position: absolute;
left: 0;
top: 100%;
width: 50%;
height: 30px;
background: linear-gradient(to left bottom, #ddd 50%, rgba(0, 0, 0, 0) 50%);
content: " ";
}
ul.arrows li div::after {
position: absolute;
left: 50%;
top: 100%;
width: 50%;
height: 30px;
background: linear-gradient(to right bottom, #ddd 50%, rgba(0, 0, 0, 0) 50%);
content: " ";
}
ul.arrows li:last-child div::after,
ul.arrows li:last-child div::before {
display: none
}
<ul class="arrows">
<li>
<div>sadf sdfsdsdf</div>
</li>
<li>
<div>sdsa sdss sdsd s </div>
</li>
<li>
<div>sdfsdf sad assdssds s sdsdds sn</div>
</li>
<li>
<div>sdsd sadfsdf asdf sadfon</div>
</li>
<li>
<div>sdf sdfsdf sss ssdss ss s asd sa gsdsdf</div>
</li>
</ul>

Shorter code and you can see the smoothness of the triangle :)
* {
margin: 0;
padding: 0; }
ul.arrows li {
background-color: #ddd !important;
display: block;
margin-bottom: 50px !important;
padding: 15px 0;
text-align: center;
list-style: none;
max-width:400px;
position: relative; }
ul.arrows li:before {
position: absolute;
top: 48px;
left: 0;
content: "";
border-right: 200px solid transparent;
border-left: 200px solid transparent;
border-top: 30px solid #ddd; }
<ul class="arrows">
<li>
<div>sadf sdfsdsdf</div>
</li>
<li>
<div>sdsa sdss sdsd s </div>
</li>
</ul>
Just tweak your code into this. Actually you got the idea of using the pseudo element border. However, you didn't specify a value for border-right and border-left width.
Hope it helps :)

Related

z-index on div and div:after are not working for my ul of tabs

I understand that my parent-child relationship is what is hindering my z-index from working properly. But of the solutions I have seen, I am not able to fix without losing the hierarchy needed for my future development (The active class functionality, which is not yet implemented).
Background Info:
I'm making a tabs component, and my goal is mirror this design (note the slanted tab ends):
Here's what I was able to do:
The only issue with this is that this code is using float: right; for the li elements instead of what I want float: left;.
So because of that my tabs are ordered 4-1 instead of the proper order of 1-4.
When I do use float: left;, this issue comes up where my divs for the slanted tab ends are hidden behind the li elements:
Only the last tab's slanted div is left visible, as it is the only one not blocked.
Here's the Code:
ul.tabs {
margin: 0px;
// overflow: hidden;
clip-path: inset(0 -100vw 0 0);
display: inline-block;
}
ul.tabs>li.active {
// z-index: 2;
float: left; // text-align:right;
padding-right: 40px;
padding-top: 6px;
padding-left: 40px;
height: 56px;
background: lightblue;
box-shadow: 0 10px 20px rgba(0, 0, 0, .5);
max-width: 222px;
position: relative;
z-index: 1;
box-sizing: border-box;
border: 1px solid #10172E;
}
.tab-slice.active:after {
content: '';
position: relative;
width: 10%; //40px
height: 100%;
top: 36px;
right: 1px;
border-right: 18px solid transparent;
border-bottom: 54.5px solid lightblue;
z-index: 3;
}
ul.tabs>li {
float: left;
padding-right: 40px;
padding-top: 6px;
padding-left: 40px;
height: 56px;
background: darkblue;
box-shadow: 0 10px 20px rgba(0, 0, 0, .5);
max-width: 222px;
position: relative;
z-index: 1;
box-sizing: border-box;
border: 1px solid #10172E;
}
ul.tabs>li>a {
display: inline-block;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
text-decoration: none;
color: $alis-white;
}
.tab-slice {
content: '';
position: absolute; //relative;
width: .5%;
height: 100%;
bottom: -1px;
right: -20px;
border-right: 18px solid transparent;
border-bottom: 56px solid #10172E;
z-index: 4;
}
.tab-slice:after {
content: '';
position: relative;
width: 10%; //40px
height: 100%;
top: 36px;
right: 1px;
border-right: 18px solid transparent;
border-bottom: 54.5px solid darkblue;
z-index: 4;
}
<div class="breadcrumb-container">
<div class="flight-search "><a (click)="openSearch"><mat-icon>search</mat-icon></a></div>
<ul class="tabs">
<li>
Tab 1
<div class="tab-slice "></div>
</li>
<li class="active">
Tab 2
<div class="tab-slice active"></div>
</li>
<li>
Tab 3
<div class="tab-slice"></div>
</li>
<li>
Tab 4
<div class="tab-slice"></div>
</li>
</ul>
</div>
The second to last option proposed in that article, almost works. but winds up looking like this:
I did this by commenting out the position attribute.
ul.tabs>li {
// position: relative;
}
How do I fix this layering issue?
This is the best I can fix it, the core solution is to reverse the elements when you add them in html. Then you can use the flex property flex-direction: row-reverse; so that the pseudo elements always come on the top!
Was not able to find a solution for the border thing for the pseudo element!
ul.tabs {
margin: 0px;
clip-path: inset(0 -100vw 0 0);
display: inline-flex;
flex-direction: row-reverse;
list-style: none;
align-items: center;
justify-content: center;
}
ul.tabs>li.active {
// z-index: 2;
float: left; // text-align:right;
padding-right: 40px;
padding-top: 6px;
padding-left: 40px;
height: 56px;
background: lightblue;
box-shadow: 0 10px 20px rgba(0, 0, 0, .5);
max-width: 222px;
position: relative;
z-index: 1;
box-sizing: border-box;
}
ul.tabs>li {
padding-right: 40px;
padding-top: 6px;
padding-left: 40px;
height: 56px;
background: darkblue;
box-shadow: 0 10px 20px rgba(0, 0, 0, .5);
max-width: 222px;
position: relative;
z-index: 1;
box-sizing: border-box;
border: 1px solid #10172E;
border-right:1px;
display:flex;
align-items: center;
justify-content: center;
}
ul.tabs>li>a {
display: inline-block;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
text-decoration: none;
color: $alis-white;
}
ul.tabs>li:after {
content: '';
position: absolute;
width: 10%;
height: 0;
top: 0px;
left: calc(100% - 1px);
border-right: 18px solid transparent;
border-bottom: 56px solid darkblue;
}
li.active:after {
border-right: 18px solid transparent !important;
border-bottom: 56px solid lightblue !important;
}
<div class="breadcrumb-container">
<div class="flight-search ">
<a (click)="openSearch">
<mat-icon>search</mat-icon>
</a>
</div>
<ul class="tabs">
<li>
Tab 4
</li>
<li>
Tab 3
</li>
<li class="active">
Tab 2
</li>
<li>
Tab 1
</li>
</ul>
</div>

Create a rectangle with a pointer? [duplicate]

This question already has an answer here:
Breadcrumb Chevrons CSS
(1 answer)
Closed 10 months ago.
Is there a way to create this in HMTL & CSS? I've been trying for a few hours now and I can't seem to get anywhere close to it.
I saw this example but it used SCSS and I can't use it for this
project I'm working on. https://codepen.io/gditoro/pen/oNzrJeV
I also saw this but when I applied it to my div only the width
height and background color changed.
https://css-tricks.com/the-shapes-of-css/#aa-pointer-via-amsakanna-alt
HTML
<div class="steps">
Pin Check
</div>
CSS
.steps {
width: 200px;
height: 40px;
position: relative;
background: red;
}
#steps:after {
content: "";
position: absolute;
left: 0;
bottom: 0;
width: 0;
height: 0;
border-left: 20px solid white;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
}
#steps:before {
content: "";
position: absolute;
right: -20px;
bottom: 0;
width: 0;
height: 0;
border-left: 20px solid red;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
}
Thank you,
There's nothing very magic about SCSS, it just translates some stuff into pure CSS before you run.
So, if you run that first codepen and use the browser devtools you can copy the CSS and the HTML and try that.
This is what I got:
.pointer .text-content p {
text-align: center;
}
p {
display: block;
margin-block-start: 1em;
margin-block-end: 1em;
margin-inline-start: 0px;
margin-inline-end: 0px;
}
.pointer .text-content {
display: inline-block;
position: relative;
top: calc(0.25em* -0.5);
left: calc(0.25em* 2.5);
min-width: calc(0.25em* 28);
min-height: calc(0.25em* 17);
margin-right: calc(0.25em* 4);
vertical-align: middle;
color: #ffffff;
}
.pointer {
display: inline-block;
font-size: 16px;
padding-left: calc(0.25em*5);
padding-right: calc(0.25em*5);
padding-top: calc(0.25em*2);
padding-bottom: calc(0.25em*2);
height: calc(0.25em*16);
position: relative;
background: #777777;
max-width: calc(0.25em*32);
min-width: calc(0.25em*12);
-webkit-clip-path: polygon(calc(0.25em* 42 * 0.85) 0, calc(0.25em* 42) 50%, calc(0.25em* 42 * 0.85) 100%, 0% 100%, calc(0.25em* 32 * 0.15) 50%, 0% 0%);
clip-path: polygon(calc(0.25em* 42 * 0.85) 0, calc(0.25em* 42) 50%, calc(0.25em* 42 * 0.85) 100%, 0% 100%, calc(0.25em* 32 * 0.15) 50%, 0% 0%);
}
<div class="pointer">
<div class="text-content">
<p>L</p>
</div>
</div>
<div class="pointer">
<div class="text-content">
<p>Lorem ipsum dolor sit amet</p>
</div>
</div>
<div class="pointer">
<div class="text-content">
<p>Lorem ipsum dolor sit amet</p>
</div>
</div>
Obviously you'll want to look at the actual dimensions to suit your use case but this at least gives a basic start.
Use this -
.steps {
padding-left: 0;
list-style: none;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 12px;
line-height: 1;
margin: 30px auto;
border-radius: 3px;
}
.steps strong {
font-size: 14px;
display: block;
line-height: 1.4;
}
.steps>li {
position: relative;
display: block;
/* border: 1px solid #ddd; */
padding: 12px 50px 8px 50px;
width: 140px;
height: 40px;
}
#media (min-width: 768px) {
.steps>li { float: left; }
.steps .past { color: #666; background: #ececec; }
.steps .present { color: #000; }
.steps .future { color: #777; background: #efefef; }
.steps li > span:after,
.steps li > span:before {
content: "";
display: block;
width: 0px;
height: 0px;
position: absolute;
top: 0;
left: 0;
border: solid transparent;
border-left-color: #f0f0f0;
border-width: 30px;
}
.steps li > span:after {
top: -5px;
z-index: 1;
border-left-color: white;
border-width: 34px;
}
.steps li > span:before { z-index: 2; }
.steps li.past + li > span:before { border-left-color: #ececec; }
.steps li.present + li > span:before { border-left-color: #fff; }
.steps li.future + li > span:before { border-left-color: #efefef; }
.steps li:first-child > span:after,
.steps li:first-child > span:before { display: none; }
/* Arrows at start and end */
.steps li:first-child i,
.steps li:last-child i {
display: block;
position: absolute;
top: 0;
left: 0;
border: solid transparent;
border-left-color: white;
border-width: 30px;
}
.steps li:last-child i {
left: auto;
right: -30px;
border-left-color: transparent;
border-top-color: white;
border-bottom-color: white;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<ul class="steps">
<li class="past">
<span>
<strong>Step 1</strong>
Blah blah blah.
</span><i></i>
</li>
<li class="present">
<span>
<strong>Step 2</strong>
Blah blah blah.
</span><i></i>
</li>
<li class="future">
<span>
<strong>Step 3</strong>
Blah blah blah.
</span><i></i>
</li>
</ul>
</body>
</html>

How to keep text in anchor tag in the same position when border property is used

I am planning to use Bootstrap's Scrollspy component to work on a <ul> element.
The issue for me is that when I use the border-left property on a <li> element, the text in the anchor tag gets shifted a little to the right.
What could I do to fix this?
Please see Pen:
https://codepen.io/AshNaz87/pen/QmVJVY
.wrapper {
position: fixed;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
li {
list-style: none;
margin-bottom: 0.5rem;
padding-left: 1rem;
}
li:last-child {
margin: 0;
}
.with-border {
border-left: 3px solid grey;
}
a {
text-decoration: none;
color: #000;
}
<div class="wrapper">
<ul class="nav">
<li class="with-border">Fortune</li>
<li>Favours</li>
<li>The</li>
<li class="with-border">Brave</li>
</ul>
</div>
The reason why you're seeing this inconsistent offset of the text is because the border of an element actually take up physical space in the layout. To circumvent this, you will need to account for the space the border will take (see solution 1), or use alternative strategies that do not alter the flow of the document (see solution 2 and 3).
You can either use a:
transparent left-border on all your elements <li>,
background-image to visually mimic a border, or
abolustely positioned pseudo-element
Solution 1: Transparent left border
This solution means introducing a transparent border on all <li> elements, and simply changing the border-color property when needed:
li {
border-left: 3px solid transparent;
}
li.with-border {
border-color: grey;
}
.wrapper {
position: fixed;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
li {
border-left: 3px solid transparent;
list-style: none;
margin-bottom: 0.5rem;
padding-left: 1rem;
}
li:last-child {
margin: 0;
}
li.with-border {
border-color: grey;
}
a {
text-decoration: none;
color: #000;
}
<div class="wrapper">
<ul class="nav">
<li class="with-border">Fortune</li>
<li>Favours</li>
<li>The</li>
<li class="with-border">Brave</li>
</ul>
</div>
Solution 2: background-image to mimic border
Alternatively, you can use a linear gradient as a background image with a clearly demarcated border/breakpoint, to visually mimic a border:
li.with-border {
background-image: linear-gradient(90deg, grey 3%, transparent 3%);
}
.wrapper {
position: fixed;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
li {
list-style: none;
margin-bottom: 0.5rem;
padding-left: 1rem;
}
li:last-child {
margin: 0;
}
li.with-border {
background-image: linear-gradient(90deg, grey 3%, transparent 3%);
}
a {
text-decoration: none;
color: #000;
}
<div class="wrapper">
<ul class="nav">
<li class="with-border">Fortune</li>
<li>Favours</li>
<li>The</li>
<li class="with-border">Brave</li>
</ul>
</div>
Solution 3: Absolutely-positioned pseudo-element
This solution is the most verbose one: it uses a generated pseudo-element that is absolutely positioned within the <li> element to visually mimic a border:
li {
position: relative;
}
li::before {
position: absolute;
top: 0;
left: 0;
bottom: 0;
width: 3px;
display: none;
content: '';
background-color: grey;
}
li.with-border::before {
display: block;
}
.wrapper {
position: fixed;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
li {
position: relative;
list-style: none;
margin-bottom: 0.5rem;
padding-left: 1rem;
}
li:last-child {
margin: 0;
}
li::before {
position: absolute;
top: 0;
left: 0;
bottom: 0;
width: 3px;
display: none;
content: '';
background-color: grey;
}
li.with-border::before {
display: block;
}
a {
text-decoration: none;
color: #000;
}
<div class="wrapper">
<ul class="nav">
<li class="with-border">Fortune</li>
<li>Favours</li>
<li>The</li>
<li class="with-border">Brave</li>
</ul>
</div>

Move mobile nav from left to right

I am trying to move mobile navigation from top left corner and slide in from left side to the right side. I've tried to change position settings from left to right, but it didn't work.
I will really appreciate any help!
Code below, thank you!
#wrapper {
position: absolute;
width: auto;
min-width: 60px;
height: 100%;
overflow: hidden;
margin: 0 auto;
padding: 0;
}
label {
cursor: pointer;
}
&:focus {
outline: none;
}
.menu {
position: absolute;
top: 0;
left: 0;
background: #fff;
width: 240px;
height: 100%;
transform: translate3d(-240px, 0, 0);
transition: transform 0.35s;
}
label.menu-toggle {
position: absolute;
right: -60px;
width: 60px;
height: 60px;
line-height: 0px;
display: block;
padding: 0;
text-indent: -9999px;
background: transparent url(https://cdn4.iconfinder.com/data/icons/wirecons-free-vector-icons/32/menu-alt-512.png) 50% 50% / 25px 25px no-repeat;
}
label.active {
background: transparent url(menu-cross.png) 50% 50% / 25px 25px no-repeat;
}
ul li>label {
background: url(https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-arrow-right-b-128.png) 95% 50% / 16px 16px no-repeat;
}
a,
label {
display: block;
text-align: left;
padding: 0 30px;
line-height: 60px;
text-decoration: none;
margin: 0 auto;
color: #000;
}
&:hover {
color: #666;
}
.menu-checkbox{
display: none;
}
.menu .menu label.menu-toggle {
background: none;
}
.menu-checkbox:checked + .menu {
transform: translate3d(0, 0, 0);
}
<div id="wrapper">
<input type="checkbox" id="menub" name="menu" class="menu-checkbox">
<div class="menu">
<label class="menu-toggle" for="menub"><span>Toggle</span></label>
<ul>
<li>
link
</li>
<li>
link
</li>
<li>
link
</li>
</ul>
</div>
</div>
<!-- #wrapper -->
I believe you have overcomplicated your task. You could simply open new project on visual studio and go from there. This would be the best option, since the result you want to achieve is most likely the same.
Now if you do want to stick to this, you must go carefully through your style code and what could be preventing the item to align on the right side.

Show text on top of the tick in the ruler

The code is provided in the fiddle link below.
JSFiddle Link
Code:
$(function() {
// Build "dynamic" rulers by adding items
$(".ruler[data-items]").each(function() {
var ruler = $(this).empty(),
len = Number(ruler.attr("data-items")) || 0,
item = $(document.createElement("li")),
i;
for (i = 0; i < len; i++) {
ruler.append(item.clone().text(i + 1));
}
});
// Change the spacing programatically
function changeRulerSpacing(spacing) {
$(".ruler").
css("padding-right", spacing).
find("li").
css("padding-left", spacing);
}
$("#spacing").change(function() {
changeRulerSpacing($(this).val());
});
});
.ruler, .ruler li {
margin: 0;
padding: 0;
list-style: none;
display: inline-block;
}
/* IE6-7 Fix */
.ruler, .ruler li {
*display: inline;
}
.ruler {
background: lightYellow;
box-shadow: 0 -1px 1em hsl(60, 60%, 84%) inset;
border-radius: 2px;
border: 1px solid #ccc;
color: #ccc;
margin: 0;
height: 3em;
padding-right: 1cm;
white-space: nowrap;
}
.ruler li {
padding-left: 1cm;
width: 2em;
margin: .64em -1em -.64em;
text-align: center;
position: relative;
text-shadow: 1px 1px hsl(60, 60%, 84%);
}
.ruler li:before {
content: '';
position: absolute;
border-left: 1px solid #ccc;
height: .64em;
top: -.64em;
right: 1em;
}
/* Make me pretty! */
body {
font: 12px Ubuntu, Arial, sans-serif;
margin: 20px;
}
div {
margin-top: 2em;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<ul class="ruler"><li>1</li><li>2</li><li>3</li><li>4</li></ul>
<div>
<ul class="ruler" data-items="10"></ul>
</div>
<div>
<label for="spacing">Spacing</label>
<select id="spacing">
<option>1cm</option>
<option>2cm</option>
<option>1in</option>
<option>1em</option>
<option>20px</option>
</select>
</div>
How can I show the text on top, next to the li tick in the provided link?
Currently, I am adding vertical-align:top to the css .ruler li but nothing changes in the UI.
Please check the image below. The requirement is shown in blue.
What css property in what css class do I need to add to make sure the text is shown at top and next to the tick?
Simply move the list items slightly to the right and up. Then move the :before pseudo elements the same amount to the left and down.
http://jsfiddle.net/kwcug/1006/
And I'm not sure why my update causes JSFiddle to think this one now has 1006 revisions.
Add some left position to your ruler li and adjust your right position in li:before
$(function() {
// Build "dynamic" rulers by adding items
$(".ruler[data-items]").each(function() {
var ruler = $(this).empty(),
len = Number(ruler.attr("data-items")) || 0,
item = $(document.createElement("li")),
i;
for (i = 0; i < len; i++) {
ruler.append(item.clone().text(i + 1));
}
});
// Change the spacing programatically
function changeRulerSpacing(spacing) {
$(".ruler").
css("padding-right", spacing).
find("li").
css("padding-left", spacing);
}
$("#spacing").change(function() {
changeRulerSpacing($(this).val());
});
});
.ruler,
.ruler li {
margin: 0;
padding: 0;
list-style: none;
display: inline-block;
}
/* IE6-7 Fix */
.ruler,
.ruler li {
*display: inline;
}
.ruler {
background: lightYellow;
box-shadow: 0 -1px 1em hsl(60, 60%, 84%) inset;
border-radius: 2px;
border: 1px solid #ccc;
color: #ccc;
margin: 0;
height: 3em;
padding-right: 1cm;
white-space: nowrap;
}
.ruler li {
padding-left: 1cm;
width: 2em;
margin: .64em -1em -.64em;
text-align: center;
position: relative;
text-shadow: 1px 1px hsl(60, 60%, 84%);
top: -.64em;
left: .64em
}
.ruler li:before {
content: '';
position: absolute;
border-left: 1px solid #ccc;
height: .64em;
right: 1.4em;
}
/* Make me pretty! */
body {
font: 12px Ubuntu, Arial, sans-serif;
margin: 20px;
}
div {
margin-top: 2em;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link rel="stylesheet" src="http://fonts.googleapis.com/css?family=Ubuntu" />
<ul class="ruler">
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
</ul>
<div>
<ul class="ruler" data-items="10"></ul>
</div>
<div>
<label for="spacing">Spacing</label>
<select id="spacing">
<option>1cm</option>
<option>2cm</option>
<option>1in</option>
<option>1em</option>
<option>20px</option>
</select>
</div>
Does this help?
http://jsfiddle.net/kwcug/1008/
I changed this
.ruler li {
margin: .64em -1em -.64em;
}
.ruler li:before {
content: '';
position: absolute;
border-left: 1px solid #ccc;
height: .64em;
top: -.64em;
right: 1em;
}
to
.ruler li:before {
content: '';
border-left: 1px solid #ccc;
margin-right: .2em;
}
.ruler li {
margin: 0 -1em -.64em;
}