How To Add A Half Circle At The Bottom Middle Of My Header?
Here is how I want it to look: I realize this is an ugly mockup and obviously when I do it for real the proportions will look better, but I am wondering how you would go about doi
Solution 1:
Use the :after
pseudo element:
.header:after {
content: '';
position: absolute;
background: black;
width: 50px;
height: 50px;
z-index: 1;
border-radius: 50%; /* Makes the element circular */bottom: -25px;
left: 50%;
margin-left: -25px;
}
For this solution, overflow: hidden;
has been removed from the .header
CSS.
Here's a fiddle: http://jsfiddle.net/t97AX/
Here's another approach, that doesn't rely on the width of the semicircle to center it properly:
.header:after {
content: '';
position: relative;
top: 100%;
display: block;
margin: 0 auto;
background: red;
width: 50px;
height: 25px;
border-radius: 0050px50px;
}
The fiddle (semicircle red for the sake of clarity): http://jsfiddle.net/x4mdC/
More on :before
and :after
: http://www.w3.org/TR/CSS2/selector.html#before-and-after
Solution 2:
Use :after
and border-radius
to create the semicircle.
.header {
position: fixed;
top: 0;
left: 0;
right: 0;
background-color: #000;
height: 110px;
}
.header:after {
content: '';
background-color: red;
position: absolute;
display: block;
width: 100px;
top: 110px;
left: 50%;
margin-left: -50px;
height: 50px;
border-radius: 0050px50px;
}
Solution 3:
<divclass="header"><divclass="circle"></div></div>.header {
position:fixed;top:0;left:0;width:100%;background:#000;height:110px;
}
.circle {
height:100px;width:100px;border-radius:100px;background-color:black;margin:auto;position:relative;top:45px;
}
in action: http://jsfiddle.net/NickWilde/ngcce/
Post a Comment for "How To Add A Half Circle At The Bottom Middle Of My Header?"