CSS Curved Background - html

I've had a look around and cannot find anyone with a solution for this:
The issue: A client of mine is looking to have curved bottom sides to certain divs on their page. Some backgrounds will have a photo, some will have a subtle pattern (making the use of .PNG images difficult like I've done here: www.bootbro.com
So far I have this:
Link: http://jsfiddle.net/dg44thbr/1/
CSS:
body {
margin: 0;
}
.alignCenter {
text-align: center;
}
.padAll {
padding: 25px;
}
div#banner {
position: relative;
background-image: url(http://wearepeak.co.uk/wp-content/uploads/2016/02/testimonial.jpg);
width: 100%;
border-bottom-left-radius: 50%;
border-bottom-right-radius: 50%;
z-index: 555;
border-bottom:3px solid red;
}
div#content {
position: relative;
background-image: url(http://wearepeak.co.uk/wp-content/uploads/2016/05/ux-787980_1920-1750x750.jpg);
width: 100%;
margin-top: -175px;
border-bottom-left-radius: 50%;
border-bottom-right-radius: 50%;
z-index: 444;
border-bottom:3px solid red;
}
div#section {
position: relative;
background-image: url(http://wearepeak.co.uk/wp-content/uploads/2016/07/balloons-1750x500.jpg);
width: 100%;
margin-top: -175px;
border-bottom-left-radius: 50%;
border-bottom-right-radius: 50%;
z-index: 333;
border-bottom:3px solid red;
}
.left {
float: left;
}
.right {
float: right;
}
.clear::after {
clear: both;
content: "";
display: table;
}
.container {
max-width: 500px;
margin: auto;
}
.curveContent {
padding-top: 200px;
}
HTML:
<div id="banner" class="alignCenter padAll">Content here</div>
<div id="content" class="alignCenter padAll">
<div class="curveContent">
<p>Content here</p>
<p>But on another line! Oh no!</p>
<p>And another line?! What is this>!</p>
</div>
</div>
<div id="section">
<div class="container clear">
<div class="curveContent">
<div class="left col2">
<p>Content here</p>
<p>But on another line! Oh no!</p>
<p>And another line?! What is this>!</p>
</div>
<div class="right col2">
Right text
</div>
</div>
</div>
</div>
As you can see, the radius changes depending on the height of the div - something out of my control as this will be affected by containing content. Also the borders become thinner when they get to the sides.
Does anyone have any potential solutions for this?
Thank you

Border-radius can take a few static values such as border-radius: 0 0 200px 200px /15px;
body {
margin: 0;
}
.alignCenter {
text-align: center;
}
.padAll {
padding: 25px;
}
div#banner {
position: relative;
background-image: url(http://wearepeak.co.uk/wp-content/uploads/2016/02/testimonial.jpg);
width: 100%;
border-radius: 0 0 200px 200px /15px;
z-index: 555;
border-bottom:3px solid red;
}
div#content {
position: relative;
background-image: url(http://wearepeak.co.uk/wp-content/uploads/2016/05/ux-787980_1920-1750x750.jpg);
width: 100%;
margin-top: -175px;
border-radius: 0 0 200px 200px /15px;
z-index: 444;
border-bottom:3px solid red;
}
div#section {
position: relative;
background-image: url(http://wearepeak.co.uk/wp-content/uploads/2016/07/balloons-1750x500.jpg);
width: 100%;
margin-top: -175px;
border-radius: 0 0 200px 200px /15px;
z-index: 333;
border-bottom:3px solid red;
}
.left {
float: left;
}
.right {
float: right;
}
.clear::after {
clear: both;
content: "";
display: table;
}
.container {
max-width: 500px;
margin: auto;
}
.curveContent {
padding-top: 200px;
}
<div id="banner" class="alignCenter padAll">Content here</div>
<div id="content" class="alignCenter padAll">
<div class="curveContent">
<p>Content here</p>
<p>But on another line! Oh no!</p>
<p>And another line?! What is this>!</p>
</div>
</div>
<div id="section">
<div class="container clear">
<div class="curveContent">
<div class="left col2">
<p>Content here</p>
<p>But on another line! Oh no!</p>
<p>And another line?! What is this>!</p>
</div>
<div class="right col2">
Right text
</div>
</div>
</div>
</div>
http://jsfiddle.net/dg44thbr/3/

Related

How do I align 3 circular images?

So I have this code:
/*--- Circular images --- */
.img-circular1, .img-circular2, .img-circular3{
width: 200px;
height: 200px;
background-size: cover;
display: block;
border-radius: 100px;
-webkit-border-radius: 100px;
-moz-border-radius: 100px;
float: left;
background: red;
}
.img-circular1{
background-image: url('/Images/learn.jpg');
}
.img-circular2{
background-image: url('/Images/watch.jpg');
}
.img-circular3{
background-image: url('/Images/practice.jpg');
}
#container1
{
top: 100px;
position: relative;
margin-left:auto;
margin-right:auto;
width:70%;
background-color: green;
overflow: auto;
bottom: 0;
}
<div id="container1" style="padding-bottom: 500px;">
<div class="img-circular1"></div>
<div class="img-circular2"></div>
<div class="img-circular3"></div>
<div class="img-circular1"></div>
</div>
I have no managed to get 2 of them to show in a green box. But the third (which I duplicated before and after the other 2) will not show for some reason?
Also, they are not equidistant apart - how can I get them an equal spacing apart?
Please help
NOTE: Instead of images there are red circles, just for visibility reasons.
Apply float: left on images themself, not on container:
/*--- Circular images --- */
.img-circular1, .img-circular2, .img-circular3{
/*width: 200px;*/
/*height: 200px;*/
width: 100px;
height: 100px;
background-size: cover;
display: block;
border-radius: 100px;
-webkit-border-radius: 100px;
-moz-border-radius: 100px;
float: left;
}
.img-circular1{
background-image: url('/Imageslearn.jpg');
background: #aaa; /*added to as an alternative to image*/
}
.img-circular2{
background-image: url('/Images/watch.jpg');
background: #aaa; /*added to as an alternative to image*/
}
.img-circular3{
background-image: url('/Images/practice.jpg');
background: #aaa; /*added to as an alternative to image*/
}
.container1{
left: 15%;
width: 70%;
/* float: left; */
height: 300px;
position: relative;
}
<div class="container1">
<div class="img-circular1"></div>
<div class="img-circular2"></div>
<div class="img-circular3"></div>
</div>
To answer your second question:
wrap circles in some other div
make their width be some percentage value and float them left
set margin on circles to margin: 0 auto.
Here is prototype for you to study:
#green {
background: green;
padding: 10px;
overflow: auto;
}
#blue {
background: blue;
width: 50%;
float: left;
border: 1px solid #fff;
box-sizing: border-box; /*good for when there is border or padding*/
}
#red {
background: red;
width: 100px;
height: 100px;
border-radius: 50%;
margin: 0 auto;
}
<div id="green">
<div id="blue">
<div id="red"></div>
</div>
<div id="blue">
<div id="red"></div>
</div>
<div id="blue">
<div id="red"></div>
</div>
<div id="blue">
<div id="red"></div>
</div>
</div>
I updated your code to use FlexBox. Since you want your circles to be equally spaced across the row, float: left won't help much. I had to add a wrapper div around each circle div so that it could expand to fill the space without distorting the circles.
/*--- Circular images --- */
.img-circular1,
.img-circular2,
.img-circular3 {
width: 200px;
height: 200px;
background-size: cover;
border-radius: 100px;
-webkit-border-radius: 100px;
-moz-border-radius: 100px;
background: red;
display: block;
margin: 0 auto;
}
.img-circular1 {
background-image: url('/Images/learn.jpg');
}
.img-circular2 {
background-image: url('/Images/watch.jpg');
}
.img-circular3 {
background-image: url('/Images/practice.jpg');
}
#container1 {
top: 100px;
position: relative;
margin-left: auto;
margin-right: auto;
width: 70%;
background-color: green;
overflow: auto;
bottom: 0;
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.wrap {
flex-grow: 1;
}
<div id="container1" style="padding-bottom: 500px;">
<div class="wrap">
<div class="img-circular1"></div>
</div>
<div class="wrap">
<div class="img-circular2"></div>
</div>
<div class="wrap">
<div class="img-circular3"></div>
</div>
<div class="wrap">
<div class="img-circular1"></div>
</div>
</div>

Creating connected circles

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>

separator by not using width hack

I often do the width hack 49% and border 1px to do seperator for 2 column. It worked, just like the below demo. But is there any better way of doing it? I want to avoid this 49% hack, because when the viewport shrink to a larger or smaller size, it's obvious and the design will break.
body{
margin:0;
}
.left {
background: #eee;
float: left;
width: 49%;
border-right:1px solid #333;
}
.right {
background: #eee;
float: right;
width: 50%;
}
img {
margin: 0 auto;
display: block;
width: 44px;
padding: 5px 0;
}
<div class="navigate" style="width: 170px;">
<div class="left">
<img src="https://cdn0.iconfinder.com/data/icons/arrow-set/512/previous_arrow_point_flat-128.png">
</div>
<div class="right">
<img src="https://cdn0.iconfinder.com/data/icons/arrow-set/512/next_arrow_point_flat-128.png">
</div>
</div>
You can use box-sizing
CSS
body {
margin:0;
}
.left {
background: #eee;
float: left;
width: 50%;
border-right:1px solid #333;
box-sizing:border-box;
}
.right {
background: #eee;
float: right;
width: 50%;
}
img {
margin: 0 auto;
display: block;
width: 44px;
padding: 5px 0;
}
HTML
<div class="navigate" style="width: 170px;">
<div class="left">
<img src="https://cdn0.iconfinder.com/data/icons/arrow-set/512/previous_arrow_point_flat-128.png">
</div>
<div class="right">
<img src="https://cdn0.iconfinder.com/data/icons/arrow-set/512/next_arrow_point_flat-128.png">
</div>
</div>
DEMO HERE

CSS two double div, one fixed one shifts horizontal

The problem is that one div shifts down and one up, why?
I did two double divs, both inline-block and floated to right, the same inside each block.
I'm tried many changings, without any solution.
.lawyer-online {
display: inline-block;
width: 200px;
height: 100px;
margin: 10px;
}
.lawyer-avatar {
display: inline-block;
height: 100px;
width: 100px;
float:right;
}
.lawyer-avatar-relative {
position: relative;
}
.lawyer-name-box{
position: absolute;
bottom: 0em;
right: 0em;
width: 100%;
height: 2em;
background: rgba(25, 126, 215, 0.9);
color: #fff;
}
.lawyer-name-box span{
padding: 10px 10px 10px 0;
}
.lawyer_description {
background: rgba(25, 126, 215, 0.5);
height: 100px;
width: 100px;
display: inline-block;
clear: right;
}
<div id="lawyer-1" class="lawyer-online">
<div class="lawyer-avatar">
<div class="lawyer-avatar-relative">
<img src="http://wdd.co.il/wp-content/uploads/2015/08/angry-judge-100x100.jpg">
<div class="lawyer-name-box">
<span>name name</span>
</div>
</div>
</div>
<div class="lawyer_description">short text</div>
</div>
<div id="lawyer-2" class="lawyer-online">
<div class="lawyer-avatar">
<div class="lawyer-avatar-relative">
<img src="http://wdd.co.il/wp-content/uploads/2015/08/angry-judge-100x100.jpg">
<div class="lawyer-name-box">
<span>name name</span>
</div>
</div>
</div>
<div class="lawyer_description">long text long text long text</div>
</div>
The problem is that one div shifts down and one up, why?
I did two double divs, both inline-block and floated to right, the same inside each block.
I'm tried many changings, without any solution.
You should add a vertical-align: top on your .lawyer-online class.
.lawyer-online {
display: inline-block;
width: 200px;
height: 100px;
margin: 10px;
vertical-align: top;
}
This behaviour is occurring because an inline-block receives by default vertical-align: baseline, which doesn't always align elements in a desired manner.
You can rectify this by explicitly specifying vertical-align: top in your declaration block for .lawyer-online. (Or middle/bottom, they work too as values.)
.lawyer-online {
display: inline-block;
width: 200px;
height: 100px;
margin: 10px;
vertical-align: top;
}
.lawyer-avatar {
display: inline-block;
height: 100px;
width: 100px;
float:right;
}
.lawyer-avatar-relative {
position: relative;
}
.lawyer-name-box{
position: absolute;
bottom: 0em;
right: 0em;
width: 100%;
height: 2em;
background: rgba(25, 126, 215, 0.9);
color: #fff;
}
.lawyer-name-box span{
padding: 10px 10px 10px 0;
}
.lawyer_description {
background: rgba(25, 126, 215, 0.5);
height: 100px;
width: 100px;
display: inline-block;
clear: right;
}
<div id="lawyer-1" class="lawyer-online">
<div class="lawyer-avatar">
<div class="lawyer-avatar-relative">
<img src="http://wdd.co.il/wp-content/uploads/2015/08/angry-judge-100x100.jpg">
<div class="lawyer-name-box">
<span>name name</span>
</div>
</div>
</div>
<div class="lawyer_description">short text</div>
</div>
<div id="lawyer-2" class="lawyer-online">
<div class="lawyer-avatar">
<div class="lawyer-avatar-relative">
<img src="http://wdd.co.il/wp-content/uploads/2015/08/angry-judge-100x100.jpg">
<div class="lawyer-name-box">
<span>name name</span>
</div>
</div>
</div>
<div class="lawyer_description">long text long text long text</div>
</div>
You need to add vertical-align:top
.lawyer-online {
display: inline-block;
width: 200px;
height: 100px;
margin: 10px;
vertical-align:top;
}

Positioning circle and line together for timeline

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>