Skip to content

Instantly share code, notes, and snippets.

@ttskch
Created October 13, 2017 07:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ttskch/5a338b88106de0bb8259e6817b1df65d to your computer and use it in GitHub Desktop.
Save ttskch/5a338b88106de0bb8259e6817b1df65d to your computer and use it in GitHub Desktop.
olを(1)形式にしつつulとolの位置関係を美しく揃えるcss
$list-margin-left: 3rem;
$ol-padding-left: 0.4rem;
ul {
margin-left: $list-margin-left;
padding-left: 0;
}
ol {
counter-reset: ol;
list-style: none;
margin-left: $list-margin-left;
padding-left: 0;
li {
counter-increment: ol;
padding-left: 0;
&:before {
content: "("counter(ol)")";
display: inline-block;
$big: 10rem;
width: $big;
box-sizing: border-box;
padding-right: $ol-padding-left;
text-align: right;
margin-left: -1 * $big;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment