Different Horizontal Lines

Written by @kerixa 20 May 2020

Draw a line when your text has been ended and start another paragraph more smartly. By using the following horizontal lines, you can even make them dynamic! Interesting!

Code Snippet:

                                                
                                                <!-- this script is provided by https://www.htmlbestcodes.com coded by: Kerixa Inc. -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
<style>
@import url("https://fonts.googleapis.com/css?family=Cabin:400");
:root {
  --sl-pad: 1rem;
  --sl-clr: mediumaquamarine;
  --txt-clr: black;
  --txt-size: 1.2rem;
}

* {
  box-sizing: border-box;
}

body {
  display: -webkit-box;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
          flex-direction: column;
  -webkit-box-align: center;
          align-items: center;
  -webkit-box-pack: center;
          justify-content: center;
  min-height: 100vh;
  font-family: 'Cabin', sans-serif;
}

.side-lines {
  margin: 0.75rem 0;
  font-size: var(--txt-size);
  color: var(--txt-clr);
}
.side-lines--single {
  display: -webkit-box;
  display: flex;
  -webkit-box-align: center;
          align-items: center;
  -webkit-box-pack: justify;
          justify-content: space-between;
  width: 100%;
  text-align: center;
}
.side-lines--single:before, .side-lines--single:after {
  content: '';
  -webkit-box-flex: 1;
          flex: 1;
  width: 100%;
  height: 2px;
  background-color: var(--sl-clr);
}
.side-lines--single:before {
  margin-right: var(--sl-pad);
}
.side-lines--single:after {
  margin-left: var(--sl-pad);
}
.side-lines--double {
  display: -webkit-box;
  display: flex;
  -webkit-box-align: center;
          align-items: center;
  -webkit-box-pack: justify;
          justify-content: space-between;
  width: 100%;
  text-align: center;
}
.side-lines--double:before, .side-lines--double:after {
  content: '';
  -webkit-box-flex: 1;
          flex: 1;
  width: 100%;
  height: 2px;
  height: 4px;
  border-top: 2px solid var(--sl-clr);
  border-bottom: 2px solid var(--sl-clr);
}
.side-lines--double:before {
  margin-right: var(--sl-pad);
}
.side-lines--double:after {
  margin-left: var(--sl-pad);
}
.side-lines--striped {
  display: -webkit-box;
  display: flex;
  -webkit-box-align: center;
          align-items: center;
  -webkit-box-pack: justify;
          justify-content: space-between;
  width: 100%;
  text-align: center;
}
.side-lines--striped:before, .side-lines--striped:after {
  content: '';
  -webkit-box-flex: 1;
          flex: 1;
  width: 100%;
  height: 6px;
  height: 12px;
  background: repeating-linear-gradient(45deg, var(--sl-clr), var(--sl-clr) 6px, transparent 6px, transparent 12px);
}
.side-lines--striped:before {
  margin-right: var(--sl-pad);
}
.side-lines--striped:after {
  margin-left: var(--sl-pad);
}
.side-lines--checkered {
  display: -webkit-box;
  display: flex;
  -webkit-box-align: center;
          align-items: center;
  -webkit-box-pack: justify;
          justify-content: space-between;
  width: 100%;
  text-align: center;
}
.side-lines--checkered:before, .side-lines--checkered:after {
  content: '';
  -webkit-box-flex: 1;
          flex: 1;
  width: 100%;
  height: 24px;
  background: linear-gradient(45deg, var(--sl-clr) 25%, transparent 25%), linear-gradient(315deg, var(--sl-clr) 25%, transparent 25%), linear-gradient(225deg, var(--sl-clr) 25%, transparent 25%), linear-gradient(135deg, var(--sl-clr) 25%, transparent 25%);
  background-size: 12px 12px;
}
.side-lines--checkered:before {
  margin-right: var(--sl-pad);
}
.side-lines--checkered:after {
  margin-left: var(--sl-pad);
}
.side-lines--snake {
  display: -webkit-box;
  display: flex;
  -webkit-box-align: center;
          align-items: center;
  -webkit-box-pack: justify;
          justify-content: space-between;
  width: 100%;
  text-align: center;
}
.side-lines--snake:before, .side-lines--snake:after {
  content: '';
  -webkit-box-flex: 1;
          flex: 1;
  width: 100%;
  height: 24px;
  -webkit-animation: move 0.5s linear infinite forwards;
          animation: move 0.5s linear infinite forwards;
  height: 16px;
  background: radial-gradient(circle at 100% 100%, transparent 30%, var(--sl-clr) 30%, var(--sl-clr) 45%, transparent 45%, transparent), radial-gradient(circle at 0 0, transparent 25%, var(--sl-clr) 25%, var(--sl-clr) 40%, transparent 40%, transparent);
  background-size: 24px 24px;
}
@-webkit-keyframes move {
  to {
    background-position: 24px 24px;
  }
}
@keyframes move {
  to {
    background-position: 24px 24px;
  }
}
.side-lines--snake:before {
  margin-right: var(--sl-pad);
}
.side-lines--snake:after {
  margin-left: var(--sl-pad);
}
</style>

<h2 class="side-lines side-lines--single">Single Lines</h2>
<h2 class="side-lines side-lines--double">Double Lines</h2>
<h2 class="side-lines side-lines--striped">Striped Lines</h2>
<h2 class="side-lines side-lines--checkered">Checkered Lines</h2>
<h2 class="side-lines side-lines--snake">Snake Lines</h2><a target='_blank' href='https://www.htmlbestcodes.com' style='font-size: 8pt; text-decoration: none'>Html Best Codes</a>                                                
                                            

Example:


About @kerixa

I am Krishna Eydat. I studied Software Engineering at University of Waterloo in Canada. I lead a few tech companies. I am passionate about the way we are connected. I would like to be part of something big or be the big deal!

K

Comments


Here you can leave us commments. Let us know what you think about this code tutorial!

0 / 300

TRENDING POST
1
2
3
4
5
VISITORS
Online Users: 12
Recent Members: TheDewalt, sahjahan, fk khan, Proper, Jenisha
advertisement 2