Line between three divs css, html - html

I'm unsure how to tackle what i'm doing.
I'm basically trying to achieve the above. I have a section tag and a list of li tags with a hr tag for the line. They overlap poorly though and don't sit/look as smoothly as i'd like.
Html:
<section class="navigation">
<li class="page_nav--one">One</li>
<hr class="page_nav--line_break" />
<li class="page_nav--two">Two</li>
<li class="page_nav--three">Three</li>
</section>
and my css looks like :
.navigation {
background: #fff;
text-align: center;
margin: 50px 0;
display: block;
.page_nav--line_break {
position: absolute;
display: block;
height: 1px;
top: -14px;
border: 0;
border-top: 1px solid #ccc;
/* margin: 1em 0; */
padding: 0;
width: 400px;
right: 202px;
z-index: 999999;
}
li {
display: inline-block;
list-style: none;
position: relative;
margin: 10px 85px;
}
li:before {
content: '';
height: 16px;
width: 16px;
background-size: 16px 16px;
position: absolute;
top: -23px;
left: 16px;
margin: auto;
cursor: pointer;
pointer-events: none;
}
li:nth-child(1):before {
background: url("trianle_image.png");
}
li:nth-child(2):before {
left: 23px;
background: url("trianle_image.png");
}
li:nth-child(3):before {
left: 35px;
background: url("trianle_image.png");
}
}
Is there a better method/way of achieving what i'm after or am I going about it the correct way?

I would probably use :after pseudo elements.
<div class="diamond"></div>
<div class="diamond"></div>
<div class="diamond"></div>
then the CSS with pseudo elements looks like this:
.diamond {
width:10px;
height:10px;
position:relative:
float:left;
margin-right:100px;
}
.diamond:last-of-type {
margin-right:0;
}
.diamond:after {
content:""
display:block;
width:100px;
height:1px;
background-color:gray;
position:absolute;
top:5px;
left:5px;
}
.diamond:last-of-type:after {
display:none;
}
So the theory is that the after element is your line (like you have) and it is as wide as the margin between the two elements, placed exactly where you need it. Then the last one is hidden.
FIDDLE

Related

CSS : Float a number value on the right top corner of an image

I'm trying to float a number on the right top of an image.
I want this number to have a background-color and overlay on top of a small portion of the image on the right top corner.
I have tried :
<li class=topoulimg><span id=bell><img src=img-img/bell.png alt=alerts></span><span class=bellnumbers>10</span></li>
css
.bellnumbers{
float:right;
font-size:12px;
background-color:red;
width:10px;
height:10px;
color:#fff;
}
but it is not working.
http://jsfiddle.net/yv5q4gvm/
Use position:absolute instead float:right for your badge (Adjust your needs).
CSS
.bell {
display: inline-block;
position: relative;
width:64px;
}
.bellnumbers {
position: absolute;
font-size:12px;
background-color:red;
width:14px;
height:14px;
color:#fff;
top: -4px;
right: -4px;
}
The float CSS property specifies that an element should be taken from
the normal flow and placed along the left or right side of its
container, where text and inline elements will wrap around it.
DEMO HERE
You can try this...
<span class="bell">
<img src=https://cdn4.iconfinder.com/data/icons/simplicio/64x64/message.png alt=alerts>
<span class="bellnumbers">10</span>
</span>
.bell {
display: inline-block;
position: relative;
background-color: #eee;
width: 48px;
height: 42px;
text-align: center;
padding-top: 6px;
}
.bell img {
width: 24px;
height: 24px;
padding-top: 10px;
}
.bellnumbers {
font-size:12px;
background-color:red;
width:16px;
line-height: 16px;
text-align: center;
color:#fff;
z-index: 2;
border-radius: 3px;
position: absolute;
left: 28px;
}
JSFiddle
Insert content from html attribute (data-count).
<button data-count="16"></button>
Insert content before every <button> element's content, and style the inserted content:
button:before {
content: attr(data-count);
}
See the live example below:
button {
position: relative;
width: 64px;
height: 64px;
margin: 10px;
background-image: url("https://cdn4.iconfinder.com/data/icons/simplicio/64x64/message.png");
background-color: white
}
button:before {
content: attr(data-count);
width: 20px;
height: 20px;
line-height: 20px;
text-align: center;
display: block;
border-radius: 20%;
background: #FF9727;
border: 1px solid #FFF;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
color: #FFF;
position: absolute;
top: -10px;
left: -10px;
}
button.bell-top-right:before {
left: auto;
right: -10px;
}
button.bell-bottom-right:before {
left: auto;
top: auto;
right: -10px;
bottom: -10px;
}
button.bell-bottom-left:before {
top: auto;
bottom: -10px;
}
<button data-count="16" class="bell-top-right"></button>
<button data-count="16" class="bell-bottom-right"></button>
<button data-count="16"></button>
<button data-count="16" class="bell-bottom-left"></button>
try this.. perhaps it will solve your purpose (try bootstrap badges that can be a help to)
<li>
<span class=bell>
<img src="https://cdn4.iconfinder.com/data/icons/simplicio/64x64/message.png">
<span class=bellnumbers>10</span>
</span>
</li>
<style>
.bellnumbers{
vertical-align: top;
font-size:17px;
letter-spacing: 3px;
background-color:#F06861;
width:27px;
height:22px;
color:#fff;
border-radius: 3px;
padding-top: 3px;
text-align: center;
position: absolute;
margin-left: -1%;
margin-top: -5px;
}
.bell{
width:64px;
margin-top: 5%;
}
</style>
As others have shown, absolute/relative positioning and 'inline-block' on the li are ideal for this. I've got the code trimmed down quite a bit, however. Demo here: https://jsfiddle.net/r09d314v/
<style type="text/css">
li {
display: inline-block;
list-style-type: none;
position: relative;
}
span {
position: absolute;
top: -8px;
right: -10px;
background: red;
color: white;
padding: 2px;
}
</style>
<li>
<img src="https://cdn4.iconfinder.com/data/icons/simplicio/64x64/message.png">
<span class="number">11</span>
</li>

Registration Process Bar CSS3 animation

What is a good way to implement this feature?
<div class="container">
<h2>Basic Progress Bar</h2>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="70" aria-valuemin="0" aria-valuemax="100" style="width:50%">
<span class="sr-only">70% Complete</span>
</div>
</div>
</div>
Should I add those numbers on the progress-bar as photos?
or I should draw the circle by CSS3? If so, could anyone provide an example?
Below is a quick live demo of how one could start creating this type of visual in CSS. This example is quick and dirty, so to adapt it for production I would recommend simplifying some of the CSS and possibly generating the HTML using JavaScript and maybe some CSS pseudoelements. Then I would look into animating the colors using CSS animations. This is just to give you an idea of how it could be done, and maybe spark some ideas.
Screenshot of the result:
Live Demo:
html, body {
background-color: #555048;
}
.segment {
position: relative;
display: inline-block;
margin-right: -10px;
}
.circle {
display: inline-block;
background-color: #A8A9AD;
width: 20px;
height: 20px;
line-height: 20px;
border-radius: 50%;
color: white;
overflow: hidden;
text-align: center;
font-size: 12px;
}
.line {
display: inline-block;
width: 80px;
height: 10px;
margin: 5px 0;
background-color: #A8A9AD;
position: relative;
left: -5px;
}
.label {
position: absolute;
left: 10px;
top: 35px;
transform: translate(-50%, 0);
font-size: 12px;
color: #A8A9AD;
}
.container {
margin: 50px;
}
.segment.active .circle, .segment.active .line {
background-color: #C0A05F;
}
.segment.active .label {
color: #C0A05F;
}
<div class="container">
<div class="segment active"><div class="circle">1</div><div class="label">PERSONAL</div><div class="line"></div></div>
<div class="segment active"><div class="circle">2</div><div class="label">PROFILE</div><div class="line"></div></div>
<div class="segment"><div class="circle">3</div><div class="label">EXPERIENCE</div><div class="line"></div></div>
<div class="segment"><div class="circle">4</div><div class="label">SETTING</div><div class="line"></div></div>
<div class="segment"><div class="circle">5</div><div class="label">CERTIFICATE</div><div class="line"></div></div>
<div class="segment"><div class="circle">6</div><div class="label">SUBMIT</div></div>
</div>
JSFiddle Version: https://jsfiddle.net/8hxqunLx/1/
Let's create something clean and beautiful!
The end result:
The HTML
This is a good place for an ordered list. All we need is this:
<ol>
<li class="complete">Personal</li>
<li class="complete">Profile</li>
<li>Experience</li>
<li>Setting</li>
<li>Certificate</li>
<li>Submit</li>
</ol>
When a step is complete, give it the complete class to change the steps background colour.
The CSS
The numbers
There is an in-depth write up of counter over on Smashing Magazine.
The numbers are created with a counter which looks like this stripped to the basics:
ol {
list-style: none;
counter-reset: counter;
}
ol li {
counter-increment: counter;
}
ol li::before {
content: counter(counter, decimal);
}
The counter-increment property provides the correct number which is placed inside with content in a ::before pseudo-element.
The numbers are then positioned above the text with position: absolute.
The progress bar
Read more about pseudo-elements over here on the MDN.
It looks like this and goes behind the numbers:
It is created with a ::before pseudo element with a background gradient. Change the two middle percentage values (at 40% in this example) as the form is completed:
ol::before {
content: '';
height: 8px;
background:
linear-gradient(to right, #BFA15F 0, #BFA15F 40%, #A8A9AD 40%, #A8A9AD 100%);
position: absolute;
left: 50px;
right: 50px;
top: 6px;
}
Style the numbers
The numbers are inserted with ol li::before, which can be styled further:
border-radius: 50% to create a circle
text-align: center and line-height: 20px to perfectly center in the circle
a background colour which is changed as the steps are completed.
Complete Example
Note: There is no whitespace between the closing </li> tag and the next opening <li>. This prevents a gap between the inline-block list items. Read more here.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: arial;
}
ol {
list-style: none;
counter-reset: counter;
position: relative;
width: 600px;
margin: 50px auto;
white-space: nowrap;
/*white-space: nowrap; means -- don't wrap the text*/
}
ol::before {
content: '';
position: absolute;
height: 8px;
background: linear-gradient(to right, #BFA15F 0, #BFA15F 40%, #A8A9AD 40%, #A8A9AD 100%);
left: 50px;
right: 50px;
top: 6px;
}
ol li {
counter-increment: counter;
display: inline-block;
position: relative;
text-transform: uppercase;
font-size: 0.7em;
padding-top: 30px;
width: 100px;
text-align: center;
}
ol li::before {
content: counter(counter, decimal);
position: absolute;
background: #A8A9AD;
top: 0;
left: 50%;
margin-left: -10px;
width: 20px;
height: 20px;
line-height: 20px;
/*Matches height value*/
text-align: center;
border-radius: 50%;
color: #FFF;
font-weight: bold;
}
ol li.complete::before {
background: #BFA15F;
}
<ol>
<li class="complete">Personal</li><li class="complete">Profile</li><li>Experience</li><li>Setting</li><li>Certificate</li><li>Submit</li>
</ol>
Animated example
If the progress bar should animate, you could create it with two pseudo elements, instead of the gradient, with the gold line sliding over the gray.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: arial;
}
ol {
list-style: none;
counter-reset: counter;
position: relative;
width: 600px;
margin: 50px auto;
white-space: nowrap;
/*white-space: nowrap; means -- don't wrap the text*/
}
ol::before {
content: '';
position: absolute;
height: 8px;
background: #A8A9AD;
left: 50px;
right: 50px;
top: 6px;
}
ol::after {
content: '';
position: absolute;
height: 8px;
background: #BFA15F;
left: 50px;
top: 6px;
animation: stretch 2s linear infinite;
}
ol li {
counter-increment: counter;
display: inline-block;
position: relative;
text-transform: uppercase;
font-size: 0.7em;
padding-top: 30px;
width: 100px;
text-align: center;
}
ol li::before {
content: counter(counter, decimal);
position: absolute;
background: #A8A9AD;
top: 0;
left: 50%;
margin-left: -10px;
width: 20px;
height: 20px;
line-height: 20px;
/*Matches height value*/
text-align: center;
border-radius: 50%;
color: #FFF;
font-weight: bold;
z-index: 1;
}
ol li.complete::before {
background: #BFA15F;
}
#keyframes stretch {
0% {
width: 0;
}
100% {
width: calc(100% - 100px);
}
}
<ol>
<li class="complete">Personal</li><li class="complete">Profile</li><li>Experience</li><li>Setting</li><li>Certificate</li><li>Submit</li>
</ol>

CSS trapezoid shape clickable area issue in chrome browser

I'm trying to get a trapezoidal perspective shape to have the whole area be clickable. I've gotten it to work in Firefox and even IE, but Chrome isn't cooperating too well.
Here's a fiddle with the shape and a link: http://jsfiddle.net/9n9uh6f6/1/
As you can tell, the link doesn't become active until you hover over the 'area' part of the text. In other browsers, the whole height of the shape is clickable.
I read that Chrome renders a perspective image differently and perhaps that's why it's not doing what it's supposed to.
Here's my CSS:
.prodcaptions {
width:136px;
height: 85px;
position:relative;
left:10%;
text-transform:uppercase;
text-align:center;
letter-spacing: 1.6px;
color: #000;
}
.prodcaptions:before {
content:"";
position:absolute;
border-radius:1px;
box-shadow:0 0 0 3px #27628e;
top:-5%;
bottom:-11%;
left:-1%;
right:-5%;
-webkit-transform:perspective(40em) rotateX(-45deg);
transform:perspective(40em) rotateX(-45deg);
}
.prodcaptions a {
z-index:999;
position:relative;
height: 85px;
display: block;
padding-top: 25px;
}
Please have look at this code:
.prodcaptions {
position: relative;
height: 150px;
width: 150px;
margin: 50px;
padding: 10px;
perspective: 150px;
perspective-origin: 50% 0;
}
a{
padding: 50px;
position: absolute;
border: 1px solid black;
transform: rotateX(-15deg);
}
Seems to work the way you want it. fiddle
Try this shape for link trapazoid shape - jsFiddle
Advantage - you can change skew property to change angle of shape! Easy and effective! Reverse value for reverse shape!
html
Click Here!
css
a {
display: block;
z-index: 1;
position: relative;
/* custom sizes */
width: 136px;
height: 85px;
/* demo-only decoration */
margin: 100px auto;
font: 16px/50px Arial, sans-serif;
text-transform: uppercase;
text-align: center;
background-color: orange;
}
a:before, a:after {
content:'';
position: absolute;
top: 0;
left: 0;
width: 100%;
bottom: 0;
z-index: -1;
/* demo-only decoration */
border-radius: 4px;
background-color: orange;
}
a:before {
transform: skew(-20deg);
left: 25px;
}
a:after {
transform: skew(20deg);
right: 25px;
left: auto;
}

span text over the image

i am try to dsiplay span text over the image when mouse hover the div.
i am try this.
html
<div id="some-div">
<a href="#"><img class='round_border type_border' src='http://www.jewsnews.co.il/wp-content/uploads/2013/08/Donald_Duck.gif'/>
<span id="some-element">Dounald
</span></a>
</div>
css look like this
<style>
#some-div{
position:relative
}
#some-element {
width:100px;
height:100px;
border: 1px solid orange;
display: none;
font-size: 10px;
bottom: 0px;
left: 0px;
right: 0px;
text-align: center;
text-transform: uppercase;
position: absolute;
top:0;
left:0;
background:rgba(255,79,50,.5);
color:Black !important;
margin-top:2px;
border:1px solid gray;
-webkit-border-radius: 500px;
-moz-border-radius: 500px;
border-radius: 500px;
}
#some-div:hover #some-element {
display: block;
position: relative;
cursor: pointer;
color:#FFFFFF;
}
a{
position: relative;
}
.type_border {
width: 100px;
height: 100px;
background: white;
position: absolute;
}
.round_border {
float: left;
border:1px solid gray;
-webkit-border-radius: 500px;
-moz-border-radius: 500px;
border-radius: 500px;
background: white;
}
</style>
Add position: absolute to span and position:relative to main div
#some-div{
position:relative
}
#some-element {
width:80px;
border: 1px solid #ccc;
display: none;
font-size: 10px;
bottom: 0px;
left: 0px;
right: 0px;
text-align: center;
text-transform: uppercase;
position: absolute;
top:0;
left:0
}
DEMO
Use Title.
<img class='img' title='Donald Duck' src='http://www.jewsnews.co.il/wp-content/uploads/2013/08/Donald_Duck.gif'/>
If you want text to be displayed on mouse hover image.
You can simply do it by using title attribute of html image element
For ex:
You will be able to see that text when mouse hoveered.
Hope this helps..
Unfortunately as far as i know you cannot insert text on the image.
Workaround for this is to have span in a div which is having background image can work
#some-div{
background-image:url('http://www.jewsnews.co.il/wp-content/uploads/2013/08/Donald_Duck.gif');
background-repeat:no-repeat;
}
check this link http://jsfiddle.net/sy6MG/

bracket style border around elements

I'm looking for a way to implement a bracket style border around my <h2> headings; I've attached an image showing exactly what I'm trying to accomplish.
The only way I can think of to achieve this effect is by using images, but I'm unsure of exactly how to do so(all of my <h2>s are of varying length/height, or if maybe there is a better way.
Any tips & insight are greatly appreciated.
**I hate to resurrect this, but what can I look towards as being the solution to the problem shown int he updated image? The right line is too far right, as well as some opacity issues above and below the text..
UPDATE:
Working jsFiddle example.
Use the following. You just need to change the font of the text or replace it for an image, and maybe change the color of the borders to match yours.
For the HTML:
<div id="h2pre"></div>
<h2>
<div id="h2inpre"></div>
<div id="h2cont">Ready for the event of a lifetime?<br/>
We'd love to hear from you.
</div>
<div id="h2inpos"></div>
</h2>​
For the CSS:
h2{
text-align:center;
position:relative;
margin-left:50%;
left:-150px
}
div{ float:left; }
#h2inpre, #h2inpos{
background-color:#fff;
height:50px;
width:20px;
border-bottom:1px solid #FFA500;
border-top:1px solid #FFA500;
}
#h2inpre{
border-left:1px solid #FFA500;
}
#h2inpos{
border-right:1px solid #FFA500;
clear:right;
}
#h2cont{
font-family:"Arial",sans-serif;
padding:5px;
background-color:#fff;
}
#h2pre{
height:1px;
width:100%;
background-color:#FFA500;
margin-top:25px;
position:absolute;
float:none;
}
​
html:
<h2 class="bracket"><span class="text">Ready for the event of a lifetime?<br>We'd love to hear from you.</span></h2>
css:
.bracket {
position: relative;
text-align: center;
color: #999;
font-size: 1.2em;
}
.bracket:before {/* vertical stripe */
content: " ";
border-top: solid 1px orange;
position: absolute;
bottom: 50%;
left: 0;
right: 0;
}
.bracket .text {
position: relative;
display: inline-block;
background: #fff;
padding: .2em 1em;
max-width: 80%;/* force that at least some of vertical stripe is still shown */
}
.bracket .text:before {/*left bracket*/
content: " ";
border: solid 1px orange;
border-right: 0px;
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: .4em;
right: 0;
}
.bracket .text:after {/*right bracket*/
content: " ";
border: solid 1px orange;
border-left: 0px;
position: absolute;
right: 0;
top: 0;
bottom: 0;
width: .4em;
right: 0;
}
demo: http://jsbin.com/ibiyal/2
You'll probably have to tinker with the padding of the text block, and the width of the left and right bracket.
Only downside is that it only works on a solid background.
It is perfectly possible. Take a look: http://tinkerbin.com/zQ1VWLLi
The HTML...
<h2 class="box">
<span>Ready for the event of a lifetime? <br/> We'd love to hear from you.</span>
</h2>
The CSS...
h2:before,
h2 span:before,
h2 span:after {
content: "";
position: absolute;
}
h2 {
position: relative;
font: 16px/1.2em cambria;
text-align: center;
}
h2:before {
top: 50%;
height: 1px; width: 100%;
background-color: orange;
}
h2 span {
display: block;
width: 50%;
padding: 7px;
margin: 0 auto;
position: relative;
background: /*same as background where it sits*/;
border: 1px solid orange;
}
h2 span:before,
h2 span:after {
left: 7%; right: 7%;
height: 1px;
background: /*same as background where it sits*/;
}
h2 span:before {
top: -1px;
}
h2 span:after {
bottom: -1px
}
You could do this with HTML and CSS.
CSS
#container {
position: relative;
height: 43px;
}
#bracks {
background-color: #fff;
margin:0 auto;
border: 1px solid black;
width: 200px;
height: 40px;
position: relative;
}
#text {
background-color: #fff;
position: absolute;
width: 150;
left: 15;
height: 22px;
top: -1;
padding: 10px;
text-align: center;
}
#strike {
position: absolute;
top: 21;
width: 100%;
border-top: 1px solid black;
}
HTML
<div id="container">
<div id="strike"> </div>
<div id="bracks">
<div id="text">Some text here.</div>
</div>
</div>