I would like to implement timeline part on my website.
I have picture how it should look but I can't think any good way to do it.
How it should look:
Actual code:
js fiddle
<div class="right ">
what should I put here to get that circle?
</div>
Most confusing part is how to get that circle and that line together?
Could anyone suggest anything?
Thank you.
You could use :after, changing the styles to your liking.
.border needs to be positioned non-statically.
.wrapper {
width: 1030px;
background-color: #534741;
height: 500px;
}
.right {
color: #fff;
width: 90%;
text-align: right;
padding: 10px 10px 0 0;
display: block;
}
.border {
border-bottom: 2px solid #000;
width: 50%;
float: right;
margin: 10px 140px 0 10px;
position: relative;
}
.border:after {
/* Position and border */
display: block;
content: '';
border: 2px solid #000;
position: absolute;
width: 32px;
right: -34px; /*** -(Width+Border) ***/
height: 32px;
bottom: -18px; /*** -((Height/2)+Border) ***/
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
}
.text {
float: right;
width: 300px;
margin-right: 90px;
}
<div class="wrapper">
<div class="right">
<h2>Text</h2>
</div>
<div class="right">
<h3>2014</h3>
</div>
<div class="right "></div>
<div class="right border"></div>
<div class="right text">
<p>Lorem ipsum doloremLorem ipsum doloremLorem ipsum doloremLorem ipsum doloremLorem ipsum dolorem</p>
</div>
</div>
JSFiddle
Try to make it with positioning and borer radius. Or simply use images.
.content-wrapper {
position: relative;
width: 400px;
margin-bottom: 30px;
}
.line .circle {
width: 50px;
height: 50px;
border-radius: 25px;
border: 1px solid black;
position: absolute;
top: -25px;
}
.line {
position: relative;
border-bottom: 1px solid black;
}
.odd .line {
margin-right: 50px;
}
.even .line {
margin-left: 50px;
}
.odd .circle {
right: -50px;
}
.even .circle {
left: -50px;
}
.content,
.header {
padding: 0 60px;
}
.odd .content,
.odd .header {
text-align: right;
}
.even .content,
.even .header {
text-align: left;
}
<div class="content-wrapper odd">
<div class="header">Some title</div>
<div class="line">
<div class="circle"></div>
</div>
<div class="content">Loerm ipsum dolerom</div>
</div>
<div class="content-wrapper even">
<div class="header">Some title</div>
<div class="line">
<div class="circle"></div>
</div>
<div class="content">Loerm ipsum dolerom</div>
</div>
Below code should work:
.box-with-circle {
width: 90%;
position: relative;
}
.box-with-circle .circle {
width: 40px;
height: 40px;
position: absolute;
top: 0;
left: 0;
margin -20px 0 0 -20px;
border: 1px solid #000;
background-color: #fff;
z-index: 1;
border-radius: 50%;
}
.box-with-circle hr {
position: relative;
top: 20px;
}
<div class="box-with-circle">
<div class="circle"></div>
<hr />
</div>
Related
I have two sticky boxes. On hovering over a particular area inside the sticky boxes a popup opens. I want these popups to appear always on top of the sticky boxes. But increasing the z index of one hides the other. Any solution ?
Note - Removing sticky from the boxes and keeping z index of both the box same solves the problem but I need the boxes to be sticky.
.box {
margin: 40px;
padding: 20px;
background: yellow;
border: 1px solid red;
position: sticky;
}
.innerBox {
width: 100px;
height: 50px;
background: lightgreen;
position: relative;
}
.popup1 {
position: absolute;
width: 50px;
height: 150px;
top: 25px;
left: 35px;
background: red;
display: none;
}
.popup2 {
position: absolute;
width: 50px;
height: 150px;
bottom: 25px;
left: 35px;
background: black;
display: none;
}
.box1:hover .popup1 {
display: block;
}
.box2:hover .popup2 {
display: block;
}
.boxUp {
z-index: 3;
}
.boxDown {
z-index: 3;
}
<div>
<div class="box boxUp">
<div class="innerBox box1">
<p>
Hover Here
</p>
<div class="popup1">
</div>
</div>
</div>
<div class="box boxDown">
<div class="innerBox box2">
<p>
Hover Here
</p>
<div class="popup2">
</div>
</div>
</div>
</div>
Set the z-index on hover the .box
.box {
margin: 40px;
padding: 20px;
background: yellow;
border: 1px solid red;
position: sticky;
}
.innerBox {
width: 100px;
height: 50px;
background: lightgreen;
position: relative;
}
.popup1 {
position: absolute;
width: 50px;
height: 150px;
top: 25px;
left: 35px;
background: red;
display: none;
}
.popup2 {
position: absolute;
width: 50px;
height: 150px;
bottom: 25px;
left: 35px;
background: black;
display: none;
}
.box1:hover .popup1 {
display: block;
}
.box2:hover .popup2 {
display: block;
}
.box:hover {
z-index: 2;
}
<div>
<div class="box boxUp">
<div class="innerBox box1">
<p>
Hover Here
</p>
<div class="popup1">
</div>
</div>
</div>
<div class="box boxDown">
<div class="innerBox box2">
<p>
Hover Here
</p>
<div class="popup2">
</div>
</div>
</div>
</div>
I have created a div and inside the div I have made bars for which I have to set max-height and height as 100% but I do not know what is the problem as the height 100% is not showing. Can anyone help me out with this. I want to show the bars height to be placed according to the values but the problem is the height is only showing when I am setting height in pixels it is not working when I place height as 100% I want to show the height to be 100% can anyone help me out with fixing this issue for me please would be grateful for your help.
Here is my code -
.bar_graph {
width: 341px;
height: 258px;
background-color: #fff;
position: absolute;
top: 15px;
left: 15px;
padding: 20px 12px;
display: block;
border: 1px solid #a3a3a3;
}
span.line_gr {
display: block;
background-color: #3d4a7b;
margin: auto;
width: 24px;
max-height: 177px;
margin-left: 0;
height: 100%;
}
.bars_area {
width: 238px;
float: right;
position: absolute;
bottom: -8px;
right: 0;
}
.bars {
float: left;
margin: 0 10px;
margin-top: 20px;
height: 100%;
width: 27px;
}
.bars >p {
font-size: 12px;
margin: 0;
line-height: 30px;
font-weight: bold;
}
.head_graph > h2 {
font-size: 14px;
font-weight: bold;
margin-bottom: 6px;
color: #000;
}
.bar_main {
height: 200px;
position: relative;
}
.bar_main > .line {
height: 60px;
width: 100%;
border-top: 1px solid #ccc;
line-height: 20px;
font-size: 12px;
}
<div class="bar_graph">
<div class="head_graph"><h2>Heading</h2></div>
<div class="bar_main">
<div class="line">3000,000 Mil</div>
<div class="line">200,000</div>
<div class="line">100,000</div>
<div class="line"></div>
<div class="bars_area">
<div class="bars">
<span class="line_gr"></span>
<p>2016</p>
</div>
<div class="bars">
<span class="line_gr"></span>
<p>2015</p>
</div>
<div class="bars">
<span class="line_gr"></span>
<p>2014</p>
</div>
<div class="bars">
<span class="line_gr"></span>
<p>2013</p>
</div>
<div class="bars">
<span class="line_gr"></span>
<p>2012</p>
</div>
</div>
</div>
</div>
I do not know what is the problem as the height 100% is not showing
A height in percent only works if the parent element also has a height (either set explicitly, or implicitly based on other properties, such as an absolute positioned element with top and bottom given).
Your .bars_area does not have such a height, so trying a height in percentage on the children won’t work either.
As others says it won't work. I can suggest you a different approach if you like you can do it.Use div instead of span.Remember I am just suggesting you another approach according your code not an answer.
.bar_graph {
width: 341px;
height: 258px;
background-color: #fff;
position: absolute;
top: 15px;
left: 15px;
padding: 20px 12px;
display: block;
border: 1px solid #a3a3a3;
}
.inner {
position: absolute;
width:5px;
height:200px;
background: grey;
bottom:25px;
}
span.line_gr {
display: block;
background-color: #3d4a7b;
margin: auto;
width: 24px;
max-height: 177px;
margin-left: 0;
height: 100%;
}
.bars_area {
width: 238px;
float: right;
position: absolute;
bottom: -8px;
right: 0;
}
.bars {
float: left;
margin: 0 10px;
margin-top: 20px;
height: 100%;
overflow: hidden;
}
.bars >p {
font-size: 12px;
margin: 0;
line-height: 30px;
font-weight: bold;
}
.head_graph > h2 {
font-size: 14px;
font-weight: bold;
margin-bottom: 6px;
color: #000;
}
.bar_main {
height: 200px;
position: relative;
}
.bar_main > .line {
height: 60px;
width: 100%;
border-top: 1px solid #ccc;
line-height: 20px;
font-size: 12px;
}
<div class="bar_graph">
<div class="head_graph"><h2>Heading</h2></div>
<div class="bar_main">
<div class="line">3000,000 Mil</div>
<div class="line">200,000</div>
<div class="line">100,000</div>
<div class="line"></div>
<div class="bars_area">
<div class="bars">
<div class="inner"></div>
<p>2016</p>
</div>
<div class="bars">
<div class="inner"></div>
<p>2015</p>
</div>
<div class="bars">
<div class="inner"></div>
<p>2014</p>
</div>
<div class="bars">
<div class="inner"></div>
<p>2013</p>
</div>
<div class="bars">
<div class="inner"></div>
<p>2012</p>
</div>
</div>
</div>
</div>
First set .bars_area to height 100% and then set position relative on .bars
I hope it is what you want.
.bar_graph {
width: 341px;
height: 258px;
background-color: #fff;
position: absolute;
top: 15px;
left: 15px;
padding: 20px 12px;
display: block;
border: 1px solid #a3a3a3;
}
span.line_gr {
display: block;
background-color: #3d4a7b;
margin: auto;
width: 24px;
max-height: 177px;
margin-left: 0;
height: 100%;
}
.bars_area {
width: 238px;
float: right;
position: absolute;
bottom: -8px;
right: 0;
height: 100%;
}
.bars {
float: left;
margin: 0 10px;
margin-top: 20px;
height: 100%;
width: 27px;
position: relative;
}
.bars >p {
font-size: 12px;
margin: 0;
line-height: 30px;
font-weight: bold;
}
.head_graph > h2 {
font-size: 14px;
font-weight: bold;
margin-bottom: 6px;
color: #000;
}
.bar_main {
height: 200px;
position: relative;
}
.bar_main > .line {
height: 60px;
width: 100%;
border-top: 1px solid #ccc;
line-height: 20px;
font-size: 12px;
}
<div class="bar_graph">
<div class="head_graph"><h2>Heading</h2></div>
<div class="bar_main">
<div class="line">3000,000 Mil</div>
<div class="line">200,000</div>
<div class="line">100,000</div>
<div class="line"></div>
<div class="bars_area">
<div class="bars">
<span class="line_gr"></span>
<p>2016</p>
</div>
<div class="bars">
<span class="line_gr"></span>
<p>2015</p>
</div>
<div class="bars">
<span class="line_gr"></span>
<p>2014</p>
</div>
<div class="bars">
<span class="line_gr"></span>
<p>2013</p>
</div>
<div class="bars">
<span class="line_gr"></span>
<p>2012</p>
</div>
</div>
</div>
</div>
The parent element should have margins and padding set to 0. Then, the child element can be given that property of height:100%;
I created a layout with 4 columns centered with margin and a triangle as an arrow-down with a star in the middle...
this is working nice in my computer:
But triangle and star are far away to be responsive, only way I achieved to position it correctly is with absolute position:
.triangle-down {
display: block;
position: absolute;
top: 0;
left: 318px;
width: 0;
height: 0;
border-left: 532px solid transparent;
border-right: 532px solid transparent;
border-top: 400px solid blue;
}
.star {
display: block;
position: absolute;
vertical-align: middle;
font-size: 250px;
text-align: center;
color: white;
top: -434px;
left: -109px;
}
How can I put the element in top of the others and make it responsive in the same way columns and it's margins?
NOTES:
layout is a countdown, but javascript is not important for the question.
You can find a functional (no JS) fiddle here
You can see actual result (with JS) here
I can use sass if necessary
How about this updated fiddle?
https://jsfiddle.net/ondrakoupil/0rtvcnon/11/
Basically, these are the changes:
use flexbox for column layout
sizes are measured using viewport-relative units (vw)
triangle is created as standard rectangular <div> and rotated via CSS - you have better control over its position and size
There are some CSS3 techniques used. For IE, you'll need to prefix them in CSS (use Autoprefixer). Other browsers should handle it "as it is".
html, body {
height: 100%;
margin: auto;
padding-left:1%;
background: yellow;
font: normal 16px 'Roboto', sans-serif;
}
.container {
margin: auto;
width: 80%;
height: 100%;
position: relative;
display: flex;
justify-content: space-between;
}
.bar {
background: red;
font-weight: 700;
text-align: center;
color: yellow;
width: 15%;
}
.init {
position:absolute;
bottom: 10px;
right: 20px;
background: yellow;
margin-left: 0px;
font-weight: 700;
text-align: right;
color: red;
}
a:link, a:visited {
color: red;
text-decoration: none;
}
::-moz-selection {
color: yellow;
background: red;
}
::selection {
color: yellow;
background: red;
}
p.numbers {
font-size: 8vw;
margin-top: 45vw;
margin-bottom: 20px;
}
p.meta, p.strings {
font-size: 2vw;
}
h1 {
font-size: 4.5em;
}
.triangle-down {
position: absolute;
top: 0;
left: 0;
right: 0;
pointer-events: none;
}
.triangle-color {
margin: auto;
width: calc(80vw / 1.4142);
height: calc(80vw / 1.4142); /* sqrt of 2 */
background-color: blue;
transform: translateY(calc(-1 * 80vw / 1.4142 / 2)) rotate(45deg);
}
.star {
position: absolute;
vertical-align: middle;
font-size: 15vw;
text-align: center;
color: white;
top: 5vw;
left: 0;
right: 0;
z-index: 1;
}
<body>
<div class="container">
<div class="triangle-down">
<div class="triangle-color"></div>
<div class="star">★</div>
</div>
<div class="bar">
<p id="d" class="numbers days">00</p>
<p class="strings">DIES</p>
</div>
<div class="bar">
<p id="h" class="numbers hours">00</p>
<p class="strings">HORES</p>
</div>
<div class="bar">
<p id="m" class="numbers minutes">00</p>
<p class="strings">MINUTS</p>
</div>
<div class="bar">
<p id="s" class="numbers seconds">00</p>
<p class="strings">SEGONS</p>
</div>
</div>
<div class="init">
ENTRA
</div>
</body>
Take a look at this. I was need to rewrite it from scratch, because you've got a lot of absolutes and they all calculated through js, as I understood. Hope, this will satisfy your requirements.
html, body {
margin: 0;
height: 100%;
}
.container {
width: 100%;
height: 100%;
background-color: yellow;
font: normal 16px 'Roboto', sans-serif;
position: relative;
}
.triangle-aspect-keeper {
width: 50%;
padding-bottom: 50%;
position: relative;
margin-left: auto;
margin-right: auto;
}
.triangle-container {
}
.triangle-down {
width: 100%;
height: 100%;
background-color: blue;
transform: rotate(45deg);
position: absolute;
top: -50%;
left: 0;
}
.star {
font-size: 1100%;
text-align: center;
color: white;
width: 100%;
line-height: 200%; /* control star vertical position */
position: absolute;
top: 0;
left: 0;
}
.bar-container {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
text-align: center;
}
.bar-inner-container {
margin-left: auto;
margin-right: auto;
width: calc(50% * 1.41); /* sqrt(2) = 1.41. Length of the diagonal of the square*/
height: 100%;
display: flex;
justify-content: space-between;
}
.bar:first-child {
margin-left: 0;
}
.bar {
background-color: red;
height: 100%;
width: 15%;
color: yellow;
font-weight: 700;
}
p.numbers {
font-size: 5em;
margin-top: 350%;
}
p.meta, p.strings {
font-sie: 1.5em;
}
a:link, a:visited {
color: red;
text-decoration: none;
}
.init {
position: absolute;
bottom: 0;
right: 0;
padding: 10px;
font-weight: 700;
}
<body>
<div class="container">
<div class="bar-container">
<div class="bar-inner-container">
<div class="bar bar-first">
<p id="d" class="numbers days">00</p><br>
<p class="strings">DIES</p><br>
</div>
<div class="bar bar-second">
<p id="h" class="numbers hours">00</p><br>
<p class="strings">HORES</p><br>
</div>
<div class="bar bar-third">
<p id="m" class="numbers minutes">00</p><br>
<p class="strings">MINUTS</p><br>
</div>
<div class="bar bar-fourth">
<p id="s" class="numbers seconds">00</p><br>
<p class="strings">SEGONS</p><br>
</div>
</div>
</div>
<div class="triangle-aspect-keeper">
<div class="triangle-container">
<div class="triangle-down"></div>
<div class="star">★</div>
</div>
</div>
<div class="init">
ENTRA
</div>
</div>
</body>
#import url('https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css');
html,
body {
background: yellow;
height: 100%;
}
.container {
position: relative;
height: 100%;
}
.row {
height: 100%;
}
.col-xs-3 {
height: 100%;
}
.col-xs-3,
.col-xs-12 {
padding: 0 6.25%;
}
.bar {
color: yellow;
background: red;
min-height: 100%;
padding-top: 333%;
}
.triangle-down {
position: absolute;
width: 100%;
height: auto;
z-index: 1;
}
.triangle-color {
margin-bottom: -30%;
}
.triangle-color * {
fill: blue
}
.star * {
fill: white
}
.numbers {
font-size: 5vw;
padding-bottom: 2vw;
}
.strings {
font-size: 1.5vw;
}
<div class="container text-center">
<div class="row triangle-down">
<div class="col-xs-12">
<svg class="triangle-color" viewBox="0 0 100 40">
<polygon points="0,0 100,0 50,40"/>
</svg>
<svg class="star" viewBox="0 0 1400 188">
<polygon points="700,0 640,188 790,68 610,68 760,188"/>
</svg>
</div>
</div>
<div class="row">
<div class="col-xs-3">
<div class="bar">
<div class="numbers">00</div>
<div class="strings">DIES</div>
</div>
</div>
<div class="col-xs-3">
<div class="bar">
<div class="numbers">00</div>
<div class="strings">HORES</div>
</div>
</div>
<div class="col-xs-3">
<div class="bar">
<div class="numbers">00</div>
<div class="strings">MINUTS</div>
</div>
</div>
<div class="col-xs-3">
<div class="bar">
<div class="numbers">00</div>
<div class="strings">SEGONS</div>
</div>
</div>
</div>
</div>
You can simply do this.
HTML:
<div class="parent">
<div class="triangle">
<div class="star">
...
</div>
</div>
</div>
CSS:
.parent {
width: xx%; /*Whatever percentage*/
height: yy%; /*Whatever percentage*/
margin: 0 auto;
position: relative;
}
.triangle {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
.star {
font-size: xx%; /*some percentage (assuming star is a font icon)*/
position: absolute;
top: 15vh;
margin: 0 auto;
}
I need to create this image:
It contains circles attached with lines. I drew in the red boxes to show that they are divs because when it's displayed on mobile it should look like this:
I've tried doing what this post says but it doesn't work for me since the li's woudln't be in the same div.
This is my code:
.steps {
max-width: 1170px;
margin: auto;
overflow: auto;
}
.step-1,
.step-2,
.step-3,
.step-4 {
width: 25%;
float: left;
}
<div class="steps">
<div class="step-1">
<div class="step-image">
<img src="step1.jpg">
</div>
<div class="step-title">Measure Your Space</div>
<div class="step-number">1
</div>
</div>
<div class="step-2">
<div class="step-image">
<img src="step2.jpg">
</div>
<div class="step-title">Your Kitchen is Designed</div>
<div class="step-number">2</div>
</div>
<div class="step-3">
<div class="step-image">
<img src="step3.jpg">
</div>
<div class="step-title">Your Materials are Shipped</div>
<div class="step-number">3</div>
</div>
<div class="step-4">
<div class="step-image">
<img src="step4.jpg">
</div>
<div class="step-title">Start contruction of your dream kitchen</div>
<div class="step-number">4</div>
</div>
</div>
How do I create the circles with lines connecting them?
Following solution is for version with lines.
To remove lines place content: none; under media-query.
section {
display: inline-block;
width: 25%;
text-align: center;
}
div {
margin: .5em;
border: 1px solid red;
padding: .5em;
position: relative;
}
a {
display: inline-block;
height: 2em;
width: 2em;
line-height: 2em;
text-align: center;
border: 1px solid;
border-radius: 50%;
background: silver;
}
a:before, a:after {
content: "";
position: absolute;
border-top: 1px solid;
margin-top: 1em;
z-index: -1;
}
a:before {
margin-left: -1px;
left: -.5em;
right: 50%;
}
a:after {
margin-right: -1px;
left: 50%;
right: -.5em;
}
section:first-child a:before,
section:last-child a:after {
content: none;
}
<main>
<section>
<div>
<p>Some content</p>
<a>1</a>
</div>
</section><section>
<div>
<p>Some content</p>
<a>2</a>
</div>
</section><section>
<div>
<p>Some content</p>
<a>3</a>
</div>
</section><section>
<div>
<p>Some content</p>
<a>4</a>
</div>
</section>
</main>
Here is a sample, with a minimal markup, and for the marker and line the ::after and ::before pseudo element is used (starting from the 2:nd position)
div.connected {
counter-reset: num;
}
div.connected div {
float: left;
width: calc(25% - 22px);
position: relative;
text-align: center;
margin: 0 10px;
padding: 80px 0 10px 0;
border: 1px solid #eee;
background: url(http://placehold.it/60/f00) no-repeat top 10px center;
}
div.connected div::after {
display: block;
counter-increment: num;
content: counter(num);
width: 1.5em;
height: 1.5em;
text-align: center;
line-height: 1.5em;
border-radius: 50%;
border: 1px solid gray;
margin: 0 auto;
}
div.connected div ~ div::before {
content: '';
position: absolute;
width: calc(100% - 1.5em + 22px);
right: calc(50% + 0.75em);
height: 1px;
background-color: gray;
bottom: calc(.75em + 10px);
z-index: -1;
}
div.connected span {
display: inline-block;
padding-bottom: 10px;
}
#media screen and (max-width: 600px) {
div.connected div {
width: calc(50% - 22px);
}
div.connected div:nth-child(n+3) {
margin-top: 20px;
}
div.connected div:nth-child(3)::before {
display: none;
}
}
<div class="connected">
<div>
<span>Some text here</span>
</div>
<div>
<span>Some text here</span>
</div>
<div>
<span>Some text here</span>
</div>
<div>
<span>Some text here</span>
</div>
</div>
Here is an updated version that solves the misalignment when an item have longer text
div.connected {
display: flex;
flex-wrap: wrap;
counter-reset: num;
}
div.connected div {
float: left;
width: calc(25% - 22px);
position: relative;
text-align: center;
margin: 0 10px;
padding: 80px 0 10px 0;
border: 1px solid #eee;
background: url(http://placehold.it/60/f00) no-repeat top 10px center;
}
div.connected div::after {
display: block;
counter-increment: num;
content: counter(num);
position: absolute;
left: calc(50% - 0.75em - 1px);
bottom: 10px;
width: 1.5em;
height: 1.5em;
text-align: center;
line-height: 1.5em;
border-radius: 50%;
border: 1px solid gray;
}
div.connected div ~ div::before {
content: '';
position: absolute;
width: calc(100% - 1.5em + 22px);
right: calc(50% + 0.75em);
height: 1px;
background-color: gray;
bottom: calc(.75em + 10px);
z-index: -1;
}
div.connected span {
display: inline-block;
padding-bottom: 30px;
}
#media screen and (max-width: 600px) {
div.connected div {
width: calc(50% - 22px);
}
div.connected div:nth-child(n+3) {
margin-top: 20px;
}
div.connected div:nth-child(3)::before {
display: none;
}
}
<div class="connected">
<div>
<span>Some text here</span>
</div>
<div>
<span>Some text here</span>
</div>
<div>
<span>Some long long long text here</span>
</div>
<div>
<span>Some text here</span>
</div>
</div>
Updated, being asked how to move text below the circles, so here is one way (see notes in CSS)
Note, since absolute positioning is used for the connectors/circles, and as longer text can wrap, one might need to adjust the bottom distance (50px) using the existing #media query.
div.connected {
display: flex;
flex-wrap: wrap;
counter-reset: num;
}
div.connected div {
float: left;
width: calc(25% - 22px);
position: relative;
text-align: center;
margin: 0 10px;
/* padding: 80px 0 10px 0; changed */
padding: 120px 0 10px 0;
border: 1px solid #eee;
background: url(http://placehold.it/60/f00) no-repeat top 10px center;
}
div.connected div::after {
display: block;
counter-increment: num;
content: counter(num);
position: absolute;
left: calc(50% - 0.75em - 1px);
/* bottom: 10px; changed */
bottom: 50px;
width: 1.5em;
height: 1.5em;
text-align: center;
line-height: 1.5em;
border-radius: 50%;
border: 1px solid gray;
}
div.connected div~div::before {
content: '';
position: absolute;
width: calc(100% - 1.5em + 22px);
right: calc(50% + 0.75em);
height: 1px;
background-color: gray;
/* bottom: calc(.75em + 10px); changed */
bottom: calc(.75em + 50px);
z-index: -1;
}
div.connected span {
display: inline-block;
}
#media screen and (max-width: 600px) {
div.connected div {
width: calc(50% - 22px);
}
div.connected div:nth-child(n+3) {
margin-top: 20px;
}
div.connected div:nth-child(3)::before {
display: none;
}
}
<div class="connected">
<div>
<span>Some text here</span>
</div>
<div>
<span>Some text here</span>
</div>
<div>
<span>Some long long long text here</span>
</div>
<div>
<span>Some text here</span>
</div>
</div>
Given the markup you have, one simple solution would be to align the horizontal line (the :after pseudo-element of .step-number) relative to .step-# div. Here's how:
.step-1,
.step-2,
.step-3,
.step-4 {
...
/* Set position of step divs to be relative. */
position: relative;
}
.step-number:after {
/* Absolutely position this to the bottom center of step-#.
15px is the radius of step-number.
A 100% width, and a 50% left expands the line's
length to the center of the next step-#. */
position: absolute;
left: 50%;
bottom: 15px;
margin-left: 15px;
...
}
.step-number {
/* A fixed width of 30px allows us to correctly position the line. */
border-radius: 20px;
width: 30px;
height: 30px;
...
}
.step-number {
border-radius: 20px;
width: 30px;
height: 30px;
line-height: 30px;
border: 1px #AAA solid;
text-align: center;
display: inline-block;
background-color: #FFF;
}
/*
Absolutely position this to the bottom center of step-#.
15px is the radius of step-number.
A 100% width, and a 50% left expands the line's
length to the center of the next step-#.
*/
.step-number:after {
content: ' ';
position: absolute;
left: 50%;
margin-left: 15px;
bottom: 15px;
width: 100%;
height: 1px;
background-color: #AAA;
}
/* Hide the line after the last step */
.step-4 .step-number:after {
display: none;
}
.steps {
max-width: 1170px;
margin: auto;
overflow: auto;
}
.step-title {
min-height: 80px;
}
.step-1,
.step-2,
.step-3,
.step-4 {
width: 22%;
vertical-align: top;
display: inline-block;
text-align: center;
/* Set position of step divs to be relative. */
position: relative;
border: 1px #FAA solid;
}
#media screen and (max-width: 400px) {
.step-number:after {
content: none;
display: none;
}
}
<div class="steps">
<div class="step-1">
<div class="step-image">
<img src="https://placehold.it/100x100">
</div>
<div class="step-title">Measure Your Space</div>
<div class="step-number">1
</div>
</div>
<div class="step-2">
<div class="step-image">
<img src="https://placehold.it/100x100">
</div>
<div class="step-title">Your Kitchen is Designed</div>
<div class="step-number">2</div>
</div>
<div class="step-3">
<div class="step-image">
<img src="https://placehold.it/100x100">
</div>
<div class="step-title">Your Materials are Shipped</div>
<div class="step-number">3</div>
</div>
<div class="step-4">
<div class="step-image">
<img src="https://placehold.it/100x100">
</div>
<div class="step-title">Start contruction of your dream kitchen</div>
<div class="step-number">4</div>
</div>
</div>
To keep up with small screens, you can add a media query to hide the horizontal lines, once the .step-#s span to multiple rows.
#media screen and (max-width: 400px) {
.step-number:after {
content: none;
display: none;
}
}
.steps {
max-width: 1170px;
margin: auto;
overflow: auto;
box-sizing:border-box;
}
.step-1,
.step-2,
.step-3,
.step-4 {
width: 90px;
height:200px;
float: left;
border:2px solid #ff0000;
box-sizing:border-box;
text-align:center;
position:relative;
margin:5px;
z-index:999;
}
img{
width:50%;
height:50px;
margin:auto;
margin-top:10px
}
.step-number{
border-radius: 50%;
border: 1px solid #000;
position: absolute;
bottom: 20px;
right: 43%;
padding: 4px;
z-index:999;
}
hr{
position: absolute;
width: 282px;
height: 1px;
right: 53px;
bottom: 23px;
z-index: 990;
}
<div class="steps">
<div class="step-1">
<div class="step-image">
<img src="https://i.stack.imgur.com/ElI1w.jpg">
</div>
<div class="step-title">Measure Your Space</div>
<div class="step-number">1
</div>
</div>
<div class="step-2">
<div class="step-image">
<img src="https://i.stack.imgur.com/ElI1w.jpg">
</div>
<div class="step-title">Your Kitchen is Designed</div>
<div class="step-number">2</div>
</div>
<div class="step-3">
<div class="step-image">
<img src="https://i.stack.imgur.com/ElI1w.jpg">
</div>
<div class="step-title">Your Materials are Shipped</div>
<div class="step-number">3</div>
</div>
<div class="step-4">
<div class="step-image">
<img src="https://i.stack.imgur.com/ElI1w.jpg">
</div>
<div class="step-title">Start contruction of your dream kitchen</div>
<div class="step-number">4</div>
<hr/>
</div>
</div>
I am trying to align to divs parallel from each other, but it is not lining up properly.
I have already tried a number of the solutions posted on the site, but none of them are working.
Any ideas on how to resolve this issue would be appreciated.
<section class="section">
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-10">
<div class="content">
<div class="wrapper">
<p class="content-media left">
<img src="http://lorempixel.com/g/400/200/" alt="">
</div>
<div>
<div class="col-xs-12">
<div class="float:right;width:45%;">
<p>Lorem Ipsum <em>Lorem</em>, Lorem impsum Lorem Ipsum Lorem Ipsum</em>.</p>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
body {
font-family: georgia, "times new roman", times, serif
}
.container {
width: 100%;
}
.container p,
.container div img {
display: inline-block;
}
.container p {
width: 60%;
float: right;
}
.container div img {
width: 38%;
float: right;
}
.logo {
position:fixed;
bottom: 25px;
left: 0px;
height: 100px;
width: 300px;
}
p {
font-size: 18px;
line-height: 22px;
margin-right: 360px;
right: 100px;
}
.dropcap {
float: left;
font-size: 76px;
line-height: 76px;
margin: 0 15px 5px 0;
}
.section {
background-color: #fff;
position: relative;
z-index: 10;
}
.section-header {
margin-top: 50px
!important;
z-index: 1;
}
.section-header-content {
position: fixed;
bottom: 400px;
left: 200px;
color: white;
}
.main-title {
position: fixed;
bottom: 400px;
left: 200px;
color: white;
}
.section-header-content2 {
position: fixed;
bottom: 50px;
left: 200px;
color: white;
}
.main-title2 {
position: fixed;
bottom: 400px;
right: 200px;
color: white;
}
.section-video-bg {
margin-top: -10px;
}
.content {
padding: 40px 0 25 ;
}
.content h3 {
font-size: 27px;
line-height: 27px;
margin: 70px 0 30px 0;
}
.content .content-media {
width: 40%;
border-top: 1px solid #FFFFFF;
border-bottom: 1px solid #FFFFFF;
padding: 30px 0;
}
.content .content-media.right {
float: right;
margin-left: 20px;
}
.content .content-media.left {
float: right;
margin-right: 800px;
bottom: 600px;
}
.content .content-media img {
max-width: 100%;
}
.column {
float: left;
width: 50%;
}
.video-container {
position: relative;
bottom: 0%;
left: 0%;
height: 100%;
width: 100%;
overflow: hidden;
background: #000;
}
.video-container video {
position: relative;
z-index: 0;
top: 0;
bottom: 0;
}
.video-container video.fixed {
position: fixed;
top: 50px;
z-index: 0;
bottom: 0;
}
.video-container video.fillWidth {
width: 100%;
}
.wrapper {
margin: 0 auto;
width: 960px;
}
/* Responsive: Portrait tablets and up */
#media screen and (min-width: 768px) {
}
You have a lot of stray divs on your html as well as a lot of css properties not needed (e.g. float property) which are already done by bootstrap's default css.
Here is the correct way to nest your div columns within a row:
<section class="section">
<div class="container">
<div class="row">
<div class="col-xs-6">
<div class="content">
<div class="wrapper">
<img src="http://lorempixel.com/g/400/200/" class="img-responsive" alt=""/>
</div>
</div>
</div>
<div class="col-xs-6">
<p>Lorem Ipsum <em>Lorem</em>, Lorem impsum Lorem Ipsum Lorem Ipsum.</p>
</div>
</div>
</div>
</section>
Here is a jsfiddle with the above code: http://jsfiddle.net/AndrewL32/623ftfc2/
Your HTML is not properly formatted
<div class="row">
<div class="col-xs-10 col-sm-10 col-md-6">
<img class="img-responsive" src="http://lorempixel.com/g/400/200/">
</div>
<div class="col-xs-2 col-sm-2 col-md-6">
<p>Lorem Ipsum</p>
</div>
</div>
https://jsfiddle.net/j0m6ddpo/1/