::before and ::after elements with title - html

Trying to make bars go on the left and right of my <h2> title.
#s-text h2 {
font-size: 2.25em;
font-weight: 700;
color: black;
margin-bottom: 20px;
padding: 0;
}
#s-text h2:after {
content: "";
position: absolute;
display: inline-block;
right: 0;
height: 10px;
width: 30px;
background-color: red;
}
#s-text h2:before {
content: "";
position: absolute;
display: inline-block;
left: 0;
height: 10px;
width: 30px;
background-color: red;
}
<div id="s-text">
<h2>Title 1</h2>
</div>

Is this what you're looking for?
#s-text {
text-align: center;
}
#s-text h2 {
font-size: 2.25em;
font-weight: 700;
color: black;
position: relative;
margin-bottom: 20px; padding: 0;
display: inline-block;
}
#s-text h2:after {
right:-1em;
}
#s-text h2:before {
left:-1em;
}
#s-text h2:before,
#s-text h2:after {
content: "";
position: absolute;
display: inline-block;
height: 10px; width: 30px;
background-color: red;
top: 50%;
transform: translateY(-50%);
}
<div id="s-text">
<h2>what is it</h2>
</div>

Related

Background image to small for desktop sceen size?

Hey Friends I noticed that the background image doesn't stretch the whole width of the screen when I set the screen width to 2560px, which is a standard desktop screen size I assume. I'm not sure though this is the first time I've done media queries. I also don't know how to upload images on here or Imgur so you can see it in action. So here's a pic
https://jsfiddle.net/khcwnm90/
Also so the code posted on SO is just so I can post the fiddle link. I think its pretty stupid that I have to do this because the only reason I'm posting the fiddle link is because I have too much code to post here.
body, html {
margin: 0;
padding: 0;
}
/*---HEADER---*/
li a {
text-decoration-line: none;
color: rgba(102,102,102,0.75);
}
header {
background-image: url(../img/wall2.jpeg);
height: 100vh;
background-attachment: fixed;
background-repeat: no-repeat;
display: flex;
justify-content: center;
align-items: center;
}
nav {
background-color: white;
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
position: fixed;
top: 0;
left: 0;
z-index: 2;
box-shadow: 0px 0px 100px grey;
}
ul {
margin-right: 30px;
margin-top: 25px;
}
li {
display: inline-block;
font-size: 1.55rem;
margin-right: 20px;
font-family: 'Rajdhani';
}
li a:hover {
cursor: pointer;
color: #1a1a1a;
transition: all 0.7s ease;
}
.after:after {
position: relative;
left: 12px;
top: 2px;
display: inline-block;
content: "";
width: 1px;
height: 20px;
background-color: rgba(102,102,102,0.25);
}
.logo { color: red;
font-size: 3.7rem;
margin: 10px;
opacity: 1;
margin-left: 30px;
}
.phrase {
text-align: center;
}
.phrase p {
color: white;
font-size: 3.5rem;
font-family: 'Arvo';
margin-bottom: 30px;
}
.phrase a {
background-color: red;
border-radius: 25px;
color: white;
font-family: 'Bitter';
font-size: 1.8rem;
padding-left: 15px;
padding-right: 15px;
padding-bottom: 10px;
padding-top: 10px;
transition: all 0.2s ease;
}
.phrase a:hover {
transition: all 0.5s ease;
background-color: #cc0000;
cursor: pointer;
}
.phrase .fas {
display: block;
color: white;
font-size: 3.5rem;
margin-top: 15px;
}
/*---PROMISE---*/
.stats {
width: 100%;
display: flex;
box-shadow: 0px 0px 150px grey;
position: relative;
z-index: 1;
background-color: white;
}
.stats div {
display: inline-block;
flex-basis: 35%;
text-align: center;
padding-bottom: 30px;
}
.stat-info {
font-size: 2rem;
color: rgba(102,102,102, 1);
font-family: 'Rajdhani';
margin-bottom: 0;
margin-top: 10px;
}
.stat-num {
color: red;
font-family: 'Rajdhani';
font-size: 3rem;
margin: 0;
font-weight: bolder;
}
.stats div:before {
display: inline-block;
content: '';
width: 2px;
height: 35px;
background-color: rgba(102,102,102, 0.60);
}
.promise {
width: 100%;
background-image: url('../img/concrete.jpg');
background-position: center;
background-attachment: fixed;
background-size: cover;
}
.promise .wrapper {
width: 100%;
background-color: rgba(0, 0, 0, 0.3);
}
.promise h1 {
position: relative;
top: 40px;
color: white;
font-family: 'Arvo';
font-size: 3.5rem;
text-align: center;
margin-top: 0;
word-spacing: 7px;
text-shadow: 0px 0px 100px grey;
}
.promise p {
color: white;
font-size: 1.8rem;
font-family: 'Rajdhani';
margin-bottom: 0;
padding-bottom: 60px;
text-align: center;
margin-top: 40px;
padding-left: 50px;
padding-right: 50px;
}
/*---FOOTER---*/
.footer .wrapper {
display: flex;
}
.footer div {
display: inline-block;
flex-basis: 33.33%;
font-family: 'Rajdhani';
color: rgba(102,102,102, 1);
margin-top: 5px;
}
.footer h1 {
font-size: 2rem;
margin-top: 15px;
}
.footer .inner {
margin-left: 55px;
}
.social .inner {
margin-left: 45px;
}
.contact .inner {
margin-left: 35px;
}
.footer .inner:before {
display: inline-block;
content: '';
width: 27.1%;
height: 2px;
background-color: rgba(102,102,102, 0.6);
position: absolute;
margin-top: 54px;
}
.footer h1 span {
display: inline;
position: relative;
}
.footer h1 span:after {
content: '';
height: 2px;
width: 100%;
background-color: red;
position: absolute;
bottom: 0;
left: 0;
}
.wrap:before {
content: '';
width: 100px;
height: 2px;
background-color: red;
position: absolute;
margin-top: 55px;
}
.links a {
display: block;
text-decoration-line: none;
color: rgba(102,102,102, 1);
font-size: 1.2rem;
position: relative;
top: -10px;
transition: color 0.4s ease;
}
.links a:hover {
color: red;
}
.contact p {
position: relative;
top: -10px;
}
.social i {
font-size: 1.7rem;
margin-right: 5px;
position: relative;
top: -20px;
color: rgba(102,102,102, 0.7);
transition: all 0.4s ease;
}
.social i:hover {
color: red;
cursor: pointer;
}
#msg {
margin-top: -15px;
}
.footer-textarea {
background-color: rgba(102,102,102, 0.2);
outline: none;
color: rgba(102,102,102, 1);
resize: none;
width: 89%;
}
.footer button {
float: right;
margin-right: 9.5%;
margin-top: -17px;
border: none;
font-family: 'Rajdhani';
font-size: 1.2rem;
transition: all ease 0.4s;
outline: none;
}
button:hover {
cursor: pointer;
color: red;
}
.dark {
color: red;
}
.copyright {
position: absolute;
background-color: white;
text-align: center;
width: 100%;
margin-bottom: 0;
font-size: 1.2rem;
padding-bottom: 4px;
}
/*-------MEDIA QUERIES-------*/
/*---LAPTOP-LARGE---*/
#media screen and (min-width: 1440px) {
/*---FOOTER---*/
.footer button {
margin-left: 16.5%;
}
}
/*---LAPTOP---*/
#media screen and (max-width: 1024px) {
/*---NAV---*/
.logo {
font-size: 3rem;
}
nav li {
font-size: 2rem;
}
/*---MAIN---*/
header {
height: 100vh;
}
.phrase p {
font-size: 3rem;
}
.phrase a {
font-size: 1.5rem;
}
.stats p {
font-size: 2rem;
}
/*---FOOTER---*/
.footer .inner {
margin-left: 30px;
}
.footer-textarea {
width: 88%;
}
.footer button {
margin-right: 10.25%;
}
.footer h1 span {
display: inline;
position: relative;
}
.footer h1 span:after {
content: '';
height: 2px;
width: 100%;
background-color: red;
position: absolute;
bottom: 0;
left: 0;
}
}
#media screen and (max-width: 1024px) and (min-height: 1366px) {
/*---MAIN---*/
header {
height: 80vh;
}
}
#media screen and (max-width: 823px) {
/*---MAIN---*/
.phrase p {
font-size: 3rem;
}
}
/*------LANDSCAPE-MODE------*/
#media screen and (max-width: 812px) {
/*---NAV---*/
nav li {
font-size: 1.7rem;
}
.logo {
font-size: 2.7rem;
}
/*---MAIN---*/
header {
height: 100vh;
}
.stats p {
font-size: 2rem;
}
.promise p {
font-size: 1.3rem;
}
/*---FOOTER---*/
.footer button {
margin-left: 8.5%;
}
.contact .inner {
margin-right: 20px;
}
}
/*---TABLET---*/
#media screen and (max-width: 768px) {
/*---NAV---*/
nav li {
font-size: 1.6rem;
}
.logo {
font-size: 3rem;
}
/*---MAIN---*/
.phrase {
top: 300px;
}
/*---FOOTER---*/
.footer h1 span {
display: inline;
position: relative;
}
.footer h1 span:after {
content: '';
height: 2px;
width: 100%;
background-color: red;
position: absolute;
bottom: 0;
left: 0;
}
.footer button {
margin-left: 7.4%;
}
}
#media screen and (max-width: 731px) {
/*---FOOTER---*/
.footer button {
margin-left: 6%;
}
.contact .inner p {
margin: 5px;
}
}
/*------LANDSCAPE-MODE-MOBILE------*/
#media screen and (max-width: 715px) {
/*---NAV---*/
.phrase {
margin-top: 30px;
}
.phrase p {
font-size: 2.5rem;
}
.phrase a {
font-size: 1.5rem;
}
nav ul {
padding-left: 0;
margin: 0;
}
nav li {
font-size: 1.4rem;
}
nav .logo {
font-size: 2.5rem;
}
/*---FOOTER---*/
.links a {
font-size: 1.1rem;
top: -13px;
}
.contact .inner {
margin-right: 15px;
}
.contact p {
margin: 5px;
}
.footer-textarea {
position: relative;
top: -5px;
width: 90.5%;
}
.footer button {
margin-top: -18px;
margin-right: 7%;
font-size: 1.1rem;
}
}
#media screen and (max-width: 586px) {
/*---MAIN---*/
.phrase p {
font-size: 2.7rem;
}
.stats p {
font-size: 1.5rem;
}
/*---FOOTER---*/
.footer .wrapper {
display: flex;
flex-direction: column;
}
.footer div {
margin: 0;
}
.footer h1 {
font-size: 2rem;
margin-top: 10px;
}
.footer .inner {
margin: 0;
}
.footer .inner:before {
display: inline-block;
content: '';
width: 100vw;
height: 2px;
background-color: rgba(102,102,102, 0.6);
position: absolute;
margin-top: 48px;
}
.footer h1 span:after {
content: '';
height: 2px;
width: 100%;
background-color: red;
position: absolute;
bottom: 1px;
left: 0;
}
.social .inner {
position: relative;
top: -10px;
}
.links a {
margin-left: 5px;
}
.social h1 {
margin-bottom: 10px;
}
#msg {
font-size: 1rem;
margin-bottom: 0;
margin-right: 25.5%;
position: absolute;
right: 5px;
top: 80px;
}
.footer button {
right: 9.25%;
margin-top: 0.2px;
}
.social i {
font-size: 1.8rem;
margin-right: 2px;
position: relative;
top: -5px;
left: 5px;
color: rgba(102,102,102, 0.7);
transition: all 0.4s ease;
}
.footer-textarea {
width: 88.5%;
margin-top: 25px;
margin-left: 5px;
}
.contact p {
margin: 5px;
font-size: 1.2rem;
}
.copyright {
background-color: red;
padding-top: 10px;
padding-bottom: 10px;
}
.copyright span {
color: white;
background-color: red;
}
}
#media screen and (max-width: 568px) {
/*---MAIN---*/
.phrase p {
font-size: 2rem;
}
.phrase a {
font-size: 1.3rem;
}
.stats p {
font-size: 1.5rem;
}
.promise p {
font-size: 1.3rem;
}
/*---FOOTER---*/
.footer .wrapper {
display: flex;
flex-direction: column;
}
.footer div {
margin: 0;
}
.footer h1 {
font-size: 2rem;
margin-top: 10px;
}
.footer .inner {
margin: 0;
}
.footer .inner:before {
display: inline-block;
content: '';
width: 100%;
height: 2px;
background-color: rgba(102,102,102, 0.6);
position: absolute;
margin-top: 48px;
}
.footer h1 span:after {
content: '';
height: 2px;
width: 100%;
background-color: red;
position: absolute;
bottom: 1px;
left: 0;
}
.social .inner {
position: relative;
top: -10px;
}
.social .inner:before {
width: 100vw;
}
.links a {
margin-left: 5px;
}
.social h1 {
margin-bottom: 10px;
}
#msg {
font-size: 1rem;
margin-bottom: 0;
margin-right: 25.5%;
position: absolute;
right: 5px;
top: 80px;
}
.footer button {
right: 9.25%;
margin-top: 0.2px;
}
.social i {
font-size: 1.8rem;
margin-right: 2px;
position: relative;
top: -5px;
left: 5px;
color: rgba(102,102,102, 0.7);
transition: all 0.4s ease;
}
.footer-textarea {
width: 88.5%;
margin-top: 30px;
margin-left: 5px;
}
.contact p {
margin: 5px;
font-size: 1.2rem;
}
.copyright {
background-color: red;
}
.copyright span {
color: white;
background-color: red;
}
}
#media screen and (max-width: 517px) {
/*---NAV---*/
nav li {
font-size: 1.1rem;
}
/*---MAIN---*/
header h1 {
font-size: 3rem;
}
/*---FOOTER---*/
.footer .wrapper {
display: flex;
flex-direction: column;
}
.footer div {
margin: 0;
}
.footer h1 {
font-size: 2rem;
margin-top: 10px;
}
.footer .inner {
margin: 0;
}
.footer .inner:before {
display: inline-block;
content: '';
width: 100vw;
height: 2px;
background-color: rgba(102,102,102, 0.6);
position: absolute;
margin-top: 48px;
}
.social .inner {
position: relative;
top: -10px;
}
.footer h1 span:after {
content: '';
height: 2px;
width: 100%;
background-color: red;
position: absolute;
bottom: 1px;
left: 0;
}
.links a {
margin-left: 5px;
}
.social h1 {
margin-bottom: 10px;
}
#msg {
font-size: 1.3rem;
margin-bottom: 0;
float: right;
margin-right: 25.5%;
position: relative;
top: 15px;
}
.footer button {
right: 9.25%;
margin-top: 0.2px;
}
.social i {
font-size: 1.8rem;
margin-right: 7px;
position: relative;
top: -5px;
left: 5px;
color: rgba(102,102,102, 0.7);
transition: all 0.4s ease;
}
.footer-textarea {
width: 88.5%;
margin-left: 5px;
margin-top: 0px;
position: relative;
top: 10px;
}
.contact p {
margin: 5px;
font-size: 1.2rem;
}
.copyright {
background-color: red;
}
.copyright span {
color: white;
background-color: red;
}
}
/*---MOBILE---*/
#media screen and (max-width: 425px) {
/*---NAV---*/
.logo {
font-size: 2.5rem;
margin-left: 10px;
}
ul {
margin: 0;
padding: 0;
}
nav li {
display: none;
}
.ham-menu {
width: 55px;
height: 55px;
position: fixed;
right: 0;
top: 4px;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.m1, .m2, .m3 {
border-radius: 4px;
margin: 4px;
width: 35px;
height: 3px;
background-color: red;
float: left;
animation-duration: 0.3s;
animation-fill-mode: forwards;
}
/*---MAIN---*/
.phrase {
top: 179px;
}
.phrase p {
font-size: 2.5rem;
margin-bottom: 10px;
}
.phrase a {
font-size: 1.3rem;
padding: 7px;
}
.phrase .fas {
margin-top: 10px;
font-size: 2.5rem;
}
.stats p {
font-size: 1.3rem;
}
.stats div {
padding-bottom: 10px;
}
.stats div:before {
height: 20px;
}
.promise h1 {
font-size: 2.7rem;
}
.promise p {
position: relative;
top: 10px;
font-size: 1.3rem;
}
/*---FOOTER---*/
.footer .wrapper {
display: flex;
flex-direction: column;
}
.footer div {
margin: 0;
}
.footer h1 {
font-size: 2rem;
margin-top: 10px;
}
.footer .inner {
margin: 0;
}
.footer .inner:before {
display: inline-block;
content: '';
width: 100vw;
height: 2px;
background-color: rgba(102,102,102, 0.6);
position: absolute;
margin-top: 48px;
}
.social .inner {
position: relative;
top: -9.5px;
}
.footer h1 span {
display: inline;
position: relative;
}
.footer h1 span:after {
content: '';
height: 2px;
width: 100%;
background-color: red;
position: absolute;
bottom: 1px;
left: 0;
}
.links a {
margin-left: 5px;
}
.social h1 {
margin-bottom: 10px;
}
#msg {
font-size: 1rem;
margin-bottom: 0;
margin-right: 25.5%;
position: absolute;
right: 5px;
top: 80px;
}
.footer button {
right: 9.25%;
margin-top: 0.2px;
}
.social i {
font-size: 1.8rem;
margin-right: 2px;
position: relative;
top: -5px;
left: 5px;
color: rgba(102,102,102, 0.7);
transition: all 0.4s ease;
}
.footer-textarea {
width: 88.5%;
margin-top: 0px;
margin-left: 5px;
}
.contact p {
margin: 5px;
font-size: 1.2rem;
}
.copyright {
background-color: red;
}
.copyright span {
color: white;
background-color: red;
}
}
#media screen and (max-width: 360px) {
.footer button {
margin-right: 8.5%;
}
}
/*---HAM-MENU-ANIMATIONS---*/
#keyframes m1 {
from {
border-radius: 4px;
margin: 4px;
width: 35px;
height: 3px;
background-color: red;
float: left;
}
to {
border-radius: 4px;
margin: 4px;
width: 35px;
height: 3px;
background-color: red;
float: left;
transform: rotate(45deg);
position: relative;
top: 12px;
}
}
#keyframes m2 {
from {
border-radius: 4px;
margin: 4px;
width: 35px;
height: 3px;
background-color: red;
float: left;
}
to {
border-radius: 4px;
margin: 4px;
width: 35px;
height: 3px;
background-color: red;
float: left;
opacity: 0;
}
}
#keyframes m3 {
from {
border-radius: 4px;
margin: 4px;
width: 35px;
height: 3px;
background-color: red;
float: left;
}
to {
border-radius: 4px;
margin: 4px;
width: 35px;
height: 3px;
background-color: red;
float: left;
transform: rotate(-45deg);
position: relative;
top: -10.5px;
}
}
New rule for .header, remove background-attachment: fixed; and add background-size: cover;:
header {
background-image: url(../img/wall2.jpeg);
height: 100vh;
background-size: cover;
background-repeat: no-repeat;
display: flex;
justify-content: center;
align-items: center;
}
You have the picture in the header and it seems like you only edited the height and not the width. Im not sure about the specs of the picture which might come out stretched but try putting this...
width: 100%;
in the style section you put the picture in . . . (header {})
if you are going to have that image as just the header then you should probably limit it to only a portion of the height but the full width. Its a lot easier to use percentages as much as you can because of the transition from mobile to desktop. When a user looks at a web page from their phone and its in pixels then it would be a lot large than they would probably like.
Use background-size: cover, it will stretch an image to fill the full size of your element.
<body style="background-image:url(bgimage.jpg)"> use this code
and then check.

iOS Swift 3 troubles to generate PDF from UIWebview

I'm currently developing an application using iOS 10 and Swift 3
The purpose of this application is to make a PDF file with the content of my UIWebview
It doesn’t work and I have to delete theses lines to generate the PDF.
<div>
#Test#
</div>
Otherwise we have a trouble with in my IBAction :
for i in 1...render.numberOfPages {
UIGraphicsBeginPDFPage();
let bounds = UIGraphicsGetPDFContextBounds()
render.drawPage(at: i - 1, in: bounds)
}
The memory increase like if it was an infini loop
The pdf is not generated and I don't understand why.
Does somebody has an idea about this ?
And I don’t understand why ?
If someone has an idea ?
My swift IBAction :
if let contentOpt = self.contentFile {
let fmt = UIMarkupTextPrintFormatter(markupText: contentOpt)
let render = UIPrintPageRenderer()
render.addPrintFormatter(self.webView.viewPrintFormatter(), startingAtPageAt: 0)
let page = CGRect(x: 0, y: 0, width: 595.2, height: 841.8) // A4, 72 dpi
let printable = page.insetBy(dx: 0, dy: 0)
render.setValue(NSValue(cgRect: page), forKey: "paperRect")
render.setValue(NSValue(cgRect: printable), forKey: "printableRect")
let pdfData = NSMutableData()
UIGraphicsBeginPDFContextToData(pdfData, CGRect.zero, nil)
print("Data ", pdfData)
for i in 1...render.numberOfPages {
UIGraphicsBeginPDFPage();
let bounds = UIGraphicsGetPDFContextBounds()
render.drawPage(at: i - 1, in: bounds)
}
UIGraphicsEndPDFContext();
let documentsPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
print("PATH => \(documentsPath)")
pdfData.write(toFile: "\(documentsPath)/file.pdf", atomically: true)
}
This is my CSS code :
<style>
.footer {
page-break-after: always;
}
#media print {
body {
-webkit-print-color-adjust: exact !important;
font-size: small;
}
.pageBreak {
page-break-after: always;
color:red;
}
.headerPDF{
width:100%;
height:50px;
}
#containerImageFuelAndMileage{
text-align: center;
margin-top: 1pt;
}
}
.green, .yellow, .red {
z-index: 10;
position: absolute;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
width: 30px;
height: 30px;
}
.green {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADUAAAApCAQAAAA/+6kbAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfgBw0QAAiIJ56tAAAB5klEQVRYw7XX3U7UQBTA8Vk2WVFU0CdgkV0QDfgoRlZDVl8HQ9SIIUYNEZU74o0xxk+MWVGEsMgzoC749QTuNvl70dW225memdKeuWja9OSXtjNnThUql1HkEZej1/KClgGPet6UDwF4zORJFXlIEB6X8qL6eEA0/mPZQgWWiIfHxawpPQTQoZYlVeA+5mgznR20SHKsZAXdE6AnlLKB7spQFt+qwB0BekpJNwOr4fVtBd0WoGc+1EtVaOFxxQFaEKDn/6AoNcq37pKrW0K3BOhFAIWpU13Ix+TX6AgFVBiyw+YF6CWHohn+YYSvsVtDNVkzbgrQK/p7cxSKMl+0t3fLpGbcEKDXHI5nKcrsGlM61DTQ9TQQStFITGsz3ZNyTYDecET/LhTDCU8F8IcLoYQ5AXprgpK/VRy7KkDvzFAwAyXsPIrZg0DButJN9yj2WIAayZCpWrjHewnS10D3WGNArpnR0wqtVNBRGdLtV67YBztItwtX2XOAPnLMDtJv+GPsW0LrHLeFTL3FON8toE8M2kPmNuY0PwRoww1K6pgm+JkAbbpCyc2ZGdtyh6Q+8Ay/NFAzDSS3nGdjWJOhNJBNdzsZwbbTQnaN9BS/u9BnTqSFbHt2H9vhZHrI/vfgHKsHg1B/AXlXUdOz+ocUAAAAAElFTkSuQmCC) #14c77c no-repeat center !important;
background-size: 20px 14px !important;
}
.yellow {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAA2CAQAAAArUtIRAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfgBw0QAR384UsHAAAD80lEQVRYw7WYT2xURRzHv+xz1bRgu8VWQKmlAoJBQ1Ir5YIJQYPEqISDGKNGEyEhMbGamKgc9IInEvVgjEJFS5EYL+pBjCFiyQYoAokNLdADqcHEiHZZirWxsB8Pu52d9968t+816bzDvp3fbz7fmd/On9+sUIqnh7tS+Qulcx/lb7bMrgDAHubOrgCM8NDsCsAUO/FmUwCgn7trt5mDEpQmrdUqtel51fnqi9qhAzXa1uhBOzs5Q4no0sdtMw3ROr7jBrXLRRanF7iXbxKgAQpsTTuCDN1MJMQfoTXtLMpxyNnPQ3xIwVf3H2+SSTtNWzkXQF9mN2sqIHuanqcz/TpYwsUA/BXqnOvgE+rTr+RmRnz4PTQ6F9plnkq+OKuvWfIWfMI5N0aBH1mUHG8L7PL9pGuc7hd4jTlp8FWBLq4b/DgdEe5tMSiP9miBDCcNvsQT6fpYwfcw5upY+eM5Kzy7Z4TfVwlth0sgw5DBj3DLjPFliQfDApus/m+eAf5z3+S+4pcQ4ktjPJt2juDxRWhbOewXuJV/jGlbanxvCP8LOb/Aemvzmh9C5GLG5LE/hD8ZXP3iXWM8GkLcwRCfRkh49NXGI/G1Me8KGBdUZtdeh4THAQe+wbUOBo3DswH8sLHsDez7njUxpssJFx6Jv4zLOsuw0MID9FgSHgeT4tFNajQJxhUr2XhfK3zJx4uSXtYNSZ769HQgNTmujSpa329Wh+olSY2y8ob7LeX5nA718jM8PL4K1R8L9X5p1WiHaK3PqYlTIdQ+Bz7vCM5qYy3KOsWC24RLIgne3nwuZfSbidx9gciOaYNOxaaFeT3mi/10WW7eRjMaNF86Q44FPRIjkdcmXXVauszbsH0WFMk6httoHUZ2Ocq8iC0kwx/G6yWxyEptH3c2cElE4+3dDdqFrAn5bUSTBgZ8+P7YS1R1EzlbPg9eNRUlHoiUOJEQ38aU8Xy7LHA7k6bq+8iGDRwH4OcaOV11pUzROn3of2wN/5kYiWM18Y9apN7yZifEYv411WPcEyNRF4tv4XfDmWRpVUC8ZSkP0hyLiXrqKkEsl/eQLZDlV8s44Dg8az1zOWwRhqfHWnVYwVXL4TzLUuHv9PV+ktXTFttps5WfQpEXEuM38qfVsmSfjX7HbYEL60+RaXD1WR46nd+w7UH37b5RAPzAloh00mMDBwP+Jbr9XuGb/pPq1bxA3TX1K68LGtW4riunBVqpTq1XU8BvQtu1v/ZNf1nE/lmrnGNVmOaOa5bXGU8Fn+QddyCjf7yFfMC1hPCPoq/j8TMkxw7ysX+FnKGbljhGkr9zWvSwurRSS9SsemVVUEGXNKQBHbFO9IjyP6DLBdf+7yKKAAAAAElFTkSuQmCC) #ffaa01 no-repeat center !important;
background-size: 18px 20px !important;
}
.red {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAArCAQAAAAA/GqmAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfgBw0QCiEweu5LAAAAP0lEQVQoz2P8b8AgwoAMrjD83/IfFUQxMWCAUaFhK8TC8ILhHorIF8b/g8JdLQzmKCLtNE6rLAx3GM6iiLwDACVJK/z9gk6AAAAAAElFTkSuQmCC) #c3002f no-repeat center !important;
background-size: 4px 17px !important;
}
.grayBack {
background: #eeeeee !important;
}
.whiteBack {
background: #ffffff !important;
}
body {
position: absolute;
display: inline;
height: 100%;
width: 100%;
margin: 0 !important;
padding: 0 !important;
}
#date {
top: 0;
right: 30px;
position: absolute;
}
</style>
<style>
#header {
position: relative;
display: block;
height: 340px;
width: 100%;
}
#logoNissan {
position: absolute;
z-index: 10;
top: 0;
left: 43px;
width: 129px;
}
#title > span {
position: absolute;
left: 206px;
top: 53px;
font-size: 15px;
font-weight: bold;
color: #343434;
}
#date {
}
#date > div {
line-height: 12px;
}
#date > span:nth-of-type(1) {
}
#date > span:nth-of-type(2) {
margin-left: 30px;
}
#date > span {
display: inline-block;
}
#date > span:nth-of-type(-n+2) {
font-size: 12px;
font-weight: bold;
color: #343434;
}
#date > span:nth-of-type(n+3) {
font-size: 12px;
font-weight: normal;
color: #343434;
}
#gray {
position: absolute;
top: 120px;
height: 190px;
width: 100%;
background: #eeeeee !important;
}
#gray > div {
display: inline-block;
}
#gray > div:nth-of-type(n+1):nth-of-type(-n+6) {
position: relative;
display: inline-block;
vertical-align: middle;
}
#gray > .green {
margin-left: 180px;
}
#gray > div:nth-of-type(n+1):nth-of-type(-n+6):nth-of-type(odd) {
margin-top: 40px;
}
#gray > div:nth-of-type(n+3):nth-of-type(-n+6):nth-of-type(odd) {
margin-left: 20px;
}
#gray > div:nth-of-type(n+1):nth-of-type(-n+6):nth-of-type(even) {
color: #343434;
font-size: 12px;
font-weight: bold;
margin-left: 20px;
margin-top: 35px;
}
#gray > #DealerLine {
left: 206px;
height: 150px;
font-weight: normal;
}
#gray > #DealerLine > span {
color: #343434;
font-size: 14px;
}
#gray > #DealerLine > span:nth-of-type(3) {
top: 10px;
position: relative;
}
#gray > #DealerLine > span:nth-of-type(even) {
margin-left: 20px;
font-weight: bold;
}
#gray > #DealerLine > span:nth-of-type(odd) {
font-weight: normal;
}
#gray > #DealerLine > div {
line-height: 10px;
}
</style>
<style>
.marginContainer{
margin-top: 6px;
}
#descriptionLineColor {
width: 951px;
}
#custDetail {
position: relative;
display: block;
width: 100%;
height: 305px;
margin-top: 25px;
}
#custTitle {
position: absolute;
left: 30px;
font-size: 16px;
font-weight: bold;
color: #c3002f;
}
#custInfos {
position: absolute;
top: 42px;
left: 30px;
line-height: 0px;
}
#vehicleTitle {
position: absolute;
top: 115px;
left: 30px;
line-height: 0px;
font-size: 16px;
font-weight: bold;
color: #c3002f;
}
#vehicleInfos {
position: absolute;
top: 140px;
left: 30px;
}
#vehicleDescription {
position: absolute;
right: 5%;
top: 42px;
width: 50vw;
text-align: center;
}
#custInfos > span {
position: relative;
color: #343434;
font-size: 14px;
text-align: left;
}
#custInfos > div {
line-height: 35px;
}
#custInfos > span:nth-of-type(odd) {
font-weight: normal;
}
#custInfos > span:nth-of-type(even) {
font-weight: bold;
}
#carImg {
position: relative;
top: 85px;
right: 6%;
display: block;
margin: 0 auto;
float: right;
width: 47%;
border-radius: 15px;
}
.containerFuel {
width: 40%;
display: inline-block;
position: relative;
}
.imageFuel {
width: 40%;
margin-top: 18px;
margin-bottom: 18px;
border-radius: 15px;
}
.iconFuelOrMileage {
width: 49px;
}
</style>
<style>
#healthCheck {
position: relative;
display: block;
width: 100%;
height: 100%;
}
#topBar {
height: 100 px;
width: 100%;
background: #f4f4f4 !important;
box-shadow: 0 4px 2px -2px #e1e1e1;
margin-bottom: 4px;
text-align: left;
padding-bottom: 10 px;
}
/*#topBar > div {
/*position: relative;
/*display: inline-block;
}*/
/*#topBar > div: nth-of-type(1) {
margin-top: 25 px;
margin-left: 30 px;
margin-bottom: 15 px;
}*/
/*
#topBar > .green {
}
#topBar > div:nth-of-type(n+2) {
margin-bottom: 9px;
vertical-align: middle;
}
#topBar > div:nth-of-type(n+4):nth-of-type(even) {
margin-left: 22px;
}
#topBar > div:nth-of-type(n+3):nth-of-type(odd) {
font-size: 12px;
font-weight: bold;
color: #343434;
}
#topBar > div:nth-of-type(1) > span:nth-of-type(1) {
font-size: 17px;
font-weight: bold;
color: #c3002f;
}*/
.CategoryTitle, .CategoryContent {
}
.CategoryTitle > div, .CategoryContent > div {
margin-left: 30px;
position: relative;
}
.CategoryTitle {
height: 45px;
width: 100%;
}
/* From all div into .CategoryTitle keep the first one */
.CategoryTitle > div:nth-of-type(1) {
display: inline-block;
top: 15px;
vertical-align: middle;
font-size: 14px;
font-weight: bold;
color: #343434;
}
.CategoryContent {
height: 25px;
width: 100%;
}
.CategoryContent > .green, .CategoryContent > .yellow, .CategoryContent > .red {
float: right;
margin-right: 30px;
margin-top: 6px;
}
/* From all div into .CategoryContent keep the first one */
.CategoryContent > div:nth-of-type(1) {
display: inline-block;
font-size: 12px;
font-weight: normal;
color: #343434;
}
#healthCheckBot {
margin-bottom: 62px;
text-align: center;
}
#fakeContent {
height: 150px;
}
</style>
<style>
#bodyPaint {
position: relative;
display: block;
width: 100%;
height: 100%;
}
#BodyTitle > span {
position: relative;
display: block;
margin-left: 30px;
}
#BodyTitle > span:nth-of-type(1) {
font-size: 17px;
font-weight: bold;
color: #c3002f;
}
#BodyTitle > span:nth-of-type(2) {
margin-top: 22px;
font-size: 17px;
font-weight: normal;
color: #343434;
}
.BodyPaintPictureContainer {
position: relative;
display: block;
width: 100%;
height: 415px;
margin: 0 auto;
border: 1px solid black;
background-color: #343434;
}
.BodyPaintPicture {
max-height: 100%;
max-width: 100%;
width: auto;
height: auto;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
#bodyPaintBot {
margin-bottom: 50px;
}
</style>
<style>
#signatures {
position: relative;
display: block;
width: 100%;
height: 450px;
}
#signaturesTitles {
position: absolute;
top: 50px;
}
#signatureOne, #signatureTwo {
position: relative;
display: inline-block;
}
#signatureOne {
margin-left: 30px;
}
#signatureTwo {
margin-left: 21px;
}
#signatureOne > div:nth-of-type(1), #signatureTwo > div:nth-of-type(1) {
font-size: 17px;
font-weight: bold;
color: #c3002f;
margin-bottom: 40px;
}
.signatureBlock {
width: 340px;
height: 300px;
background: #ffffff !important;
box-shadow: 0 0 2px 1px #8a8a8a inset;
}
</style>
<style>
/* new balises */
.containerBodyDamageElement {
margin-top: 40px;
width: 45%;
display: inline-block;
text-align: center;
}
.containerPictureDamage {
display: inline-block;
width: 45%;
}
.pictureDamage {
display: inline-block;
width: 50px;
}
.imgDamage {
width: 100px;
}
.containerContentDamage {
}
.containerSidePictureAndType {
display: -webkit-box;
top: 120px;
position: absolute;
}
.iconSideDamage {
width: 50px;
margin-left: 140px;
}
.typeDamage {
}
.commentDamage {
width: 150px;
height: 150px;
}
#annexe {
position: relative;
display: block;
width: 100%;
height: 100%;
}
#annexeTitle {
position: relative;
display: block;
padding-top: 50px;
margin-left: 30px;
font-size: 17px;
font-weight: bold;
color: #c3002f;
}
.annexePortrait {
}
.annexePicPortrait {
vertical-align: middle;
position: relative;
display: inline-block;
margin-left: 30px;
width: 200px;
height: 268px;
}
.annexeImg {
max-height: 100%;
max-width: 100%;
width: auto;
height: auto;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
.picto {
position: relative;
display: inline-block;
vertical-align: top;
height: 180px;
width: 85px;
}
.pictoNum {
position: absolute;
display: inline-block;
margin-left: 25px;
width: 45px;
height: 45px;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
background: #c3002f !important;
}
.numInside {
position: relative;
display: block;
top: 13px;
text-align: center;
font-size: 15px;
font-weight: bold;
color: #ffffff;
}
.pictoDmg {
position: absolute;
right: 0;
width: 70px;
height: 70px;
}
.imgDmg {
height: 80%;
width: 80%;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
.comment {
margin-top: 30px;
}
.dmgComment {
margin-top: 15px;
font-size: 10px;
}
.comment > .dmgType > div:nth-of-type(1) {
display: inline-block;
font-size: 12px;
font-weight: bold;
color: #343434;
}
.comment > .dmgType > div:nth-of-type(2) {
display: inline-block;
font-size: 10px;
font-weight: normal;
color: #343434;
}
#disclaimer {
font-size: 10px;
color: #343434;
}
</style>
My Html code :
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<div>
<div id="header">
<div>
<div id="custDetail">
<div id="custTitle">
<span>#CUSTOMER_DETAILS#</span>
</div>
<div id="custInfos">
<span>#NAME_LABEL# : </span>
<span>#NAME#</span>
<div> <br> </div>
<span>#PHONE_LABEL# : </span>
<span>#PHONE#</span>
</div>
<div id="vehicleDescription">
<span><b>J11 Qashqai Tekna 5DR Wagon 1.6L Turbo Diesel 4WD 4 Cyl 6sp Manual</b></span>
</div>
<div id="vehicleTitle">
<span>#VEHICLE_DETAILS#</span>
</div>
<div id="vehicleInfos">
<span>#VIN_LABEL# : </span>
<span><b>#VIN#</b></span>
<div> <br> </div>
<span>#MODEL_LABEL# : </span>
<span><b>#MODEL#</b></span>
<div> <br> </div>
<span>#REG_NUM_LABEL# : </span>
<span><b>#REG_NUM#</b></span>
<div> <br> </div>
<span>#KILOMETER_LABEL# : </span>
<span><b>#KILOMETER#</b></span>
<div> <br> </div>
<span>#CARBURANT_LABEL# : </span>
<span><b>#CARBURANT#</b></span>
<div> <br> </div>
</div>
<div>
</div>
</div>
</div>
<div id="containerImageFuelAndMileage">
<div class="containerFuel">
<div class="">
<div class="fuelDescription">
<div> #MILEAGE# : <b>#MILEAGE_VALUE#</b></div>
</div>
</div>
<div class="containerPictoFuel">
<div class="pictoFuel">
<img class="iconFuelOrMileage" alt="imgDmg" src="https://cdn4.iconfinder.com/data/icons/adiante-apps-app-templates-incos-in-grey/512/app_type_gas_stations_512px_GREY.png">
</div>
</div>
<div class="containerFuelDescription">
</div>
</div>
<div class="containerFuel">
<div class="">
<div class="fuelDescription">
<div> #FUEL# : <b>#FUEL_VALUE# </b></div>
</div>
</div>
<div class="containerPictoFuel">
<div class="pictoFuel">
<img class="iconFuelOrMileage" name="" alt="imgDmg" src="https://cdn4.iconfinder.com/data/icons/adiante-apps-app-templates-incos-in-grey/512/app_type_gas_stations_512px_GREY.png">
</div>
</div>
<div class="containerFuelDescription">
</div>
</div>
</div>
<div id="healthCheckBot">
<p> Page 1 </p>
</div>
<div class="footer"></div>
<div>
<div id="healthCheck">
<div id="topBar">
<div>
#Test#
</div>
</div>
</div>
</div>
</body>
</html>

Replicating nutrition label - expert CSS level

I am trying to emulate this nutrition label format in CSS, but I can't get the shapes right at all. The best I can come up with is fiddling with border-radius, but that gives me more of a pill shape, and still not way to get the black cut-out shape at the bottom. Has anyone replicated such a nutrition label in CSS? Would anyone be willing to try? Any help would be greatly appreciated.
Here is a link to what I have so far: jsfiddle.net/f5jczunf/
#block {
border-radius:50%/10px;
background: #ccc;
padding: 20px;
width: 50px;
height: 100px;
border: 1px solid #000;
background-color:#FFF;
text-align:center;
}
.number {
font-weight:bold;
font-size:18pt;
text-align:center;
}
<div id="block">
<span class="number">150</span>
<br/>Calories
</div>
Maybe this small example can help.
.label {
position: relative;
width: 100px;
height: 140px;
text-align: center;
border: 1px solid #000;
border-radius: 100px/50px;
overflow: hidden;
}
.title {
display: inline-block;
margin-top: 30px;
}
.bottom {
position: absolute;
bottom: -10px;
left: 0;
right: 0;
height: 50px;
color: #fff;
line-height: 40px;
border-top: 1px solid #000;
border-radius: 100px/50px;
background-color: #000;
}
<div class="label">
<span class="title">Title</span>
<span class="bottom">Bottom</span>
</div>
https://jsfiddle.net/9xs2wcbL/1/
Here's my take on it. It does require some advanced, bleeding edge CSS, however.
#import url('https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300');
body {
padding: 3em;
font-size: 16px;
font-family: 'Open Sans Condensed', sans-serif;
}
.label-list {
display: -webkit-inline-box;
display: -ms-inline-flexbox;
display: inline-flex;
}
.label-list .label-item {
text-align: center;
border: 1px solid;
position: relative;
border-radius: 2em / 0.65em;
padding: 0.2em 0.25em 1.5em;
min-width: 3.5em;
overflow: hidden;
margin: 0.1em;
z-index: 1;
background: white;
color: black;
}
.label-list .label-item h1 {
font-size: 3em;
line-height: 1em;
font-weight: 900;
margin: 0;
}
.label-list .label-item h1.smaller {
font-size: 1.75em;
margin-top: 0.5em;
}
.label-list .label-item h1 small {
font-size: 0.4em;
text-transform: none;
}
.label-list .label-item small {
font-size: 1em;
line-height: 1em;
font-weight: 900;
text-transform: uppercase;
}
.label-list .label-item span {
position: absolute;
bottom: 0.5em;
left: 0;
right: 0;
color: white;
font-size: 0.8em;
line-height: 1em;
}
.label-list .label-item span:before {
content: '';
position: absolute;
bottom: 0;
left: 0;
right: 0;
top: 0;
background: black;
z-index: -1;
border-radius: 40%;
transform-origin: center;
width: 100%;
height: 0;
padding-top: 100%;
margin: auto;
transform: rotate(45deg) translate(20%, 20%);
}
<div class="label-list">
<div class="label-item">
<h1>140</h1>
<small>Calories</small>
</div>
<div class="label-item">
<h1 class="smaller">1<small>g</small></h1>
<small>Sat Fat</small>
<span>5% DV</span>
</div>
</div>
I believe the only way to have this sort of shape in pure CSS is with a few overlapping shapes, something similar to the code below:
.wrapper {
position: relative;
height: 112px;
width: 80px;
overflow: hidden;
}
.rectangle,
.circle {
position: absolute;
box-sizing: border-box;
}
.rectangle {
height: 96px;
width: 80px;
top: 8px;
border-left: 1px solid black;
border-right: 1px solid black;
}
.circle {
width: 200px;
height: 200px;
left: -60px;
border-radius: 200px;
border: 1px solid black;
}
.top {
top: 0;
}
.bottom {
bottom: 0;
}
<div class="wrapper">
<div class="circle top"></div>
<div class="rectangle"></div>
<div class="circle bottom"></div>
</div>
https://jsfiddle.net/dylanstark/01hck5dv/
here my approach for that. I'm using before and after pseudo-elements.
before contains black bg with border-radius and it is overflowing the main #block which has overflow: hidden;.
aftercontains text that is coming from data-text attribute of #block
#block {
border-radius: 50%/10px;
background: #ccc;
padding: 20px;
width: 50px;
height: 100px;
border: 1px solid #000;
background-color: #FFF;
text-align: center;
position: relative;
overflow: hidden;
}
#block:before {
display: block;
content: " ";
position: absolute;
bottom: -15px;
left: 0;
width: 100%;
height: 50px;
border-radius: 50%;
background: black;
z-index: 0;
}
#block:after {
display: block;
content: attr(data-label);
position: absolute;
bottom: 5px;
color: white;
text-align: center;
z-index: 1;
}
.number {
font-weight: bold;
font-size: 18pt;
text-align: center;
}
<div id="block" data-label="5% DY">
<span class="number">150</span>
<br/>Calories
</div>

Targeting :after element on hover

I want to target the :after element when I hover over the #btn-home button.
#btn-home a {
display: inline-block;
color: #707070;
font-size: 1.15em;
font-weight: 600;
margin: 0 20px;
}
#btn-home {
position: relative;
display: inline-block;
margin: 0;
}
#btn-home a:after {
display: block;
position: absolute;
content: '';
margin: 0 auto;
height: 3px;
width: 25px;
background-color: red;
bottom: -7px;
left: 0;
right: 0;
}
<div id="btn-home">
HOME
</div>
I want to target the width of the :after element when hovered over #btn-home.
That is pretty easy to do. Just use the selector as #btn-home:hover a:after.
#btn-home a {
display: inline-block;
color: #707070;
font-size: 1.15em;
font-weight: 600;
margin: 0 20px;
}
#btn-home {
position: relative;
display: inline-block;
margin: 0;
}
#btn-home a:after {
display: block;
position: absolute;
content: '';
margin: 0 auto;
height: 3px;
width: 25px;
background-color: red;
bottom: -7px;
left: 0;
right: 0;
transition: all 1s ease; /* just for demo */
}
#btn-home:hover a:after{
width: 100px;
<div id="btn-home">
HOME
</div>
You need to add this in your code :
#btn-home a:after {
transition:all .4s linear;
}
#btn-home:hover a:after {
width: 50px;
}
#btn-home a {
display: inline-block;
color: #707070;
font-size: 1.15em;
font-weight: 600;
margin: 0 20px;
}
#btn-home {
position: relative;
display: inline-block;
margin: 0;
}
#btn-home a:after {
display: block;
position: absolute;
content: '';
margin: 0 auto;
height: 3px; width: 25px;
background-color: red;
bottom: -7px; left: 0; right: 0;
transition:all .4s linear;
}
#btn-home:hover a:after {
width: 50px;
}
<div id="btn-home">
HOME
</div>

Horizontal timeline in pure css

I'm trying to make a timeline in pure CSS however I seem to be running into some problems.
When I try to set the timeline div as overflow-x: scroll it still scrolls on the y access.
This is what I've got:
#timeline {
height: 500px;
width: auto;
margin: 0;
background: red;
}
.event {
height: 500px;
}
.founded {
width: 400px;
float: left;
background: blue;
}
.grant {
width: 800px;
background: yellow;
}
<ol id="timeline">
<li class="event founded"></li>
<li class="event grant"></li>
</ol>
I just want each additional entry to follow the previous one and for it all be scroll-able horizontally. If anyone could point me in the right direction that would be amazing.
Thanks.
I literally JUST had to make one of these. This is what I came up with:
body {
padding: 25px;
font-family: sans-serif;
}
.timeline {
white-space: nowrap;
overflow-x: scroll;
padding: 30px 0 10px 0;
position: relative;
}
.entry {
display: inline-block;
vertical-align: top;
background: #13519C;
color: #fff;
padding: 10px;
font-size: 12px;
text-align: center;
position: relative;
border-top: 4px solid #06182E;
border-radius: 3px;
min-width: 200px;
max-width: 500px;
}
.entry img {
display: block;
max-width: 100%;
height: auto;
margin-bottom: 10px;
}
.entry:after {
content: '';
display: block;
background: #eee;
width: 7px;
height: 7px;
border-radius: 6px;
border: 3px solid #06182E;
position: absolute;
left: 50%;
top: -30px;
margin-left: -6px;
}
.entry:before {
content: '';
display: block;
background: #06182E;
width: 5px;
height: 20px;
position: absolute;
left: 50%;
top: -20px;
margin-left: -2px;
}
.entry h1 {
color: #fff;
font-size: 18px;
font-family: Georgia, serif;
font-weight: bold;
margin-bottom: 10px;
}
.entry h2 {
letter-spacing: .2em;
margin-bottom: 10px;
font-size: 14px;
}
.bar {
height: 4px;
background: #eee;
width: 100%;
position: relative;
top: 13px;
left: 0;
}
<div class="bar"></div>
<div class="timeline">
<div class="entry">
<h1>1990</h1>
<h2>Entry Title</h2>
<img src="http://dummyimage.com/300x200/000/fff" /> Here's the info about this date
</div>
<div class="entry">
<h1>1995</h1>
Here's the info about this date
</div>
<div class="entry">
<h1>2000</h1>
Here's the info about this date
</div>
<div class="entry">
<h1>2005</h1>
Here's the info about this date
</div>
<div class="entry">
<h1>2010</h1>
Here's the info about this date
</div>
</div>
You can refer the below link also
#import url(https://fonts.googleapis.com/css?family=Dosis:500);
body{
background: #F1F1F1;
}
.container{
width: 1200px;
margin: auto;
}
.timeline{
counter-reset: year 2016;
position: relative;
}
.timeline li{
list-style: none;
float: left;
width: 33.3333%;
position: relative;
text-align: center;
text-transform: uppercase;
font-family: 'Dosis', sans-serif;
}
ul:nth-child(1){
color: #4caf50;
}
.timeline li:before{
counter-increment: year;
content: counter(year);
width: 50px;
height: 50px;
border: 3px solid #4caf50;
border-radius: 50%;
display: block;
text-align: center;
line-height: 50px;
margin: 0 auto 10px auto;
background: #F1F1F1;
color: #000;
transition: all ease-in-out .3s;
cursor: pointer;
}
.timeline li:after{
content: "";
position: absolute;
width: 100%;
height: 1px;
background-color: grey;
top: 25px;
left: -50%;
z-index: -999;
transition: all ease-in-out .3s;
}
.timeline li:first-child:after{
content: none;
}
.timeline li.active{
color: #555555;
}
.timeline li.active:before{
background: #4caf50;
color: #F1F1F1;
}
.timeline li.active + li:after{
background: #4caf50;
}
<h1>DevelopersTips</h1>
<div class="container">
<ul class="timeline">
<li class="active">Bacon</li>
<li>Rib</li>
<li>Sausage</li>
</ul>
</div>