How to create custom buttons with arrows for twitter bootstrap? - css

Semantically, the information I want to display is a series of user selectable stages of a pipeline.
Example:
[Stage1 (4 items) |> Stage2 (10 items) |> Stage3 (4 items)]
I am using bootstrap 3 and jQuery.
Here is the css I attempted to put a triangle on the right of a button.
.btn:not(:last-child)::after {
z-index:2;
position: relative;
left: 19px;
display: inline-block;
/* Triange like this > */
border-top: 6px solid transparent;
border-bottom: 6px solid transparent;
border-left: 6px solid grey;
content: '';
}
http://codepen.io/smartnut007/pen/LpLVje
The codepen has both a sample of my desired outcome and also my very unsuccessful attempt at it. I sort of figured how to make the arrow display using CSS. But, am stuck with the rest of it.
Couple of nube questions, if you will indulge me :-)
A) The arrow works on a simple button. But, the positioning of the arrow is off once I put richer html in the button. What is a smarter way to position this ?
B) As a next step, I want the active stage to be highlighted (.btn-primary or some such thing to mark it active). How can I make both the arrow and the selected section/button highlight to the same color ?
C) Is a button and button group the right way to go about it ? I am also open to others such as horizontal list group etc if it will be easier.
Whatever technique, I would prefer it to work for at least IE9+ and other major browsers.
Update:
I was able achieve most of what I wanted here http://jsfiddle.net/rqu7vrnh/2/

I sort of figured how to make the arrow display using CSS. But, am
stuck with the rest of it.
You are on the right track. Just a couple of fixes is what you need.
A) The arrow works on a simple button. But, the positioning of the
arrow is off once I put richer html in the button. What is a smarter
way to position this?
Your buttons should be positioned relative and the arrows as absolute. This will help you precisely position the arrows where you want.
B) As a next step, I want the active stage to be highlighted
(.btn-primary or some such thing to mark it active). How can I make
both the arrow and the selected section/button highlight to the same
color?
Use the :hover on your buttons to change the border-left color. Also, on the .active of your buttons, because Bootstrap way of highlighting the active button is to add the active class. You could also do that for :active and :focus while you are at it.
Example Fiddle: http://jsfiddle.net/abhitalks/onxrj3wt/1/
Example Snippet:
.btn { position: relative; }
.btn:not(:last-child)::after {
content: ''; z-index: 100;
height: 0px; width: 0px;
position: absolute;
right: -8px; top: 50%;
transform: translateY(-50%);
border-top: 8px solid transparent;
border-bottom: 8px solid transparent;
border-left: 8px solid #ddd;
}
.btn:hover { background-color: #ccc; }
.btn:active { background-color: #7ac7d2 !important; }
.btn:focus { background-color: #7ac7d2 !important; }
.btn:not(:last-child):hover::after {
border-left: 6px solid #ccc;
}
.btn:not(:last-child):active::after,
.btn:not(:last-child):focus::after
{
border-left: 6px solid #7ac7d2;
}
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container" style="margin-top:20px; margin-left:40px;">
Attempt 1
<div class="row">
<div class="btn-group" role="group">
<a href="#" class="btn btn-default" role="button">
<h3 class="text-center">767</h3>
<p class="text-muted text-center">Stage1</p>
</a>
<a href="#" class="btn btn-default" role="button">
<h3 class="text-center">17</h3>
<p class="text-muted text-center">Stage2</p>
</a>
<a href="#" class="btn btn-default" role="button">
<h3 class="text-center">7</h3>
<p class="text-muted text-center">Stage3</p>
</a>
</div>
</div>
<div class="row"> <div>
Desired Output
<div class="row">
<img src="https://s3.amazonaws.com/warning-public-resources/pipeliene-example.png" height="100"></img>
</div>
</div>
Note: The above example is a quick demo. Specificity of the elements is not considered. In your production code, you should carefully look at the specificity of the rules which override Bootstrap ones, so that !important is avoided.

Change your CSS to below snipet. Using btn-primary class will activate the button.
.btn {
height: 90px;
width: 100px;
}
.btn:not(:last-child)::after {
position: absolute;
right: -6px;
z-index: 1;
top: 50%;
margin-top: -6px;
display: inline-block;
border-top: 6px solid transparent;
border-bottom: 6px solid transparent;
border-left: 6px solid grey;
content: '';
}
.btn.btn-primary::after {
border-left: 6px solid #337ab7;
}
.btn.btn-primary::before {
position: absolute;
left: -1px;
z-index: 1;
top: 50%;
margin-top: -6px;
display: inline-block;
border-top: 6px solid transparent;
border-bottom: 6px solid transparent;
border-left: 6px solid #fff;
content: '';
}
.btn-primary p {
color: #fff;
}

This may help or give you some ideas.
body,
html {
margin-top: 20px;
margin-left: 40px;
}
button.btn.btn-cycle {
height: 150px;
width: 150px;
border-radius: 0;
border: none;
background: white;
border-top: 6px solid #f5f5f5;
border-left: 6px solid #f5f5f5;
border-bottom: 6px solid #f5f5f5;
font-size: 20px;
}
button.btn.btn-cycle:last-child {
border-right: 6px solid #f5f5f5;
}
button.btn.btn-cycle:last-child:before {
content: "";
position: absolute;
top: 33.33%;
left: 100%;
width: 0px;
height 0px;
border-top: 20px solid transparent;
border-left: 20px solid #f5f5f5;
border-bottom: 20px solid transparent;
}
button.btn.btn-cycle:not(:first-child):after {
content: "";
position: absolute;
top: 33.33%;
left: 0;
width: 0px;
height 0px;
border-top: 20px solid transparent;
border-left: 20px solid #f5f5f5;
border-bottom: 20px solid transparent;
}
button.btn.btn-cycle:first-child {
border-left: 6px solid #f5f5f5;
}
button.btn .btn-span {
font-weight: 800;
font-size: 10px;
display: block;
}
button.btn.btn-cycle:hover {
background: teal;
color: white;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid">
<div class="btn-group" role="group" aria-label="...">
<button type="button" class="btn btn-cycle">187 <span class="btn-span">ACTIVE</span>
</button>
<button type="button" class="btn btn-cycle">112 <span class="btn-span">UNACKNOWLEDGED</span>
</button>
<button type="button" class="btn btn-cycle">11 <span class="btn-span">ACKNOWLEDGED</span>
</button>
</div>
</div>

You need to understand the structure first. As per image in codepen, it shows that you want dives in row having borders with different gauge. You need to understand the placing of border as per image.
Anyways I tried answering your question But checkout Abhitalks answer and understand the things.
CodePen: http://codepen.io/anon/pen/LpLpxM
Try out below,
.wrapper {
margin-top:20px;
border-top: 9px solid #F0F0F2;
border-bottom: 9px solid #F0F0F2;
height:108px;
width:334px;
}
.box{
background-color: #fff;
float: left;
height: 90px;
padding-top: 22px;
width: 100px;
text-align:center;
border-right: 2px solid #F0F0F2;
font-size:20px;
}
.box.first {
border-left: 9px solid #F0F0F2;
width:110px;
}
.box.active {
background-color: #82C8D2;
}
.box::after {
z-index: 2;
position: relative;
left: 53px;
bottom:34px;
display: inline-block;
border-top: 6px solid transparent;
border-bottom: 6px solid transparent;
border-left: 6px solid #F0F0F2;
content: '';
}
.box.active::after {
border-left: 6px solid #82C8D2;
left: 52px;
}
.text-small {
display: block;
font-size: 8px;
font-weight: bold;
text-transform: uppercase;
}
<div class="wrapper">
<div id="div1" class="box first grid-box1">187
<span class="text-small">Active</span>
</div>
<div id="div2" class="box grid-box2">112
<span class="text-small">Unacknowledge</span>
</div>
<div id="div3" class="box grid-box3 active">11
<span class="text-small">Acknowledge</span>
</div>
</div>

Related

Is there any way to fix size of custom dropdown arrow in css?

I am trying to fix the custom dropdown arrow size but when i zoom in or zoom out webpage size of custom dropdown also changed.. Is there any solution for that??
This is current web page
When I zoom in or zoom out custom arrow size will be changed..
Here is my code :-
.container select {
border-radius: 20px;
padding: 5px 38px 7px 23px;
border: 2px solid orange;
appearance: none;
position: relative;
}
.container i.fa-angle-down {
position: absolute;
right: 69%;
top: 92.5%;
border-radius: 20px;
color: white;
background-color: orange;
padding: 8px;
padding-left: 10px;
font-size: 20px;
pointer-events: none;
}
<div class="container">
<h6>Current open positions</h6>
<div class="form-group">
<label class="search">Search by Location</label>
<select>
<option>Canada</option>
<option>USA</option>
</select><i class="fas fa-angle-down"></i>
</div>
</div>
Supply a relative container to act as a boundary for the absolute positioned child. Something like below, cheers;
.container select {
border-radius: 20px;
padding: 5px 38px 7px 23px;
border: 2px solid orange;
appearance: none;
position: relative;
}
.container i.fa-angle-down {
position: absolute;
right: 0;
top: 0;
bottom: 0;
width: 1rem;
border-radius: 20px;
color: white;
background-color: orange;
padding: 8px;
padding-left: 10px;
font-size: 20px;
pointer-events: none;
}
.custom-dd {
display: inline-block;
position: relative;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.1/css/all.min.css" rel="stylesheet"/>
<div class="container">
<h6>Current open positions</h6>
<div class="form-group">
<label class="search">Search by Location</label>
<div class="custom-dd">
<select>
<option>Canada</option>
<option>USA</option>
</select>
<i class="fas fa-angle-down"></i>
</div>
</div>
</div>

Process flow css arrows

I'm trying to get some process flow arrow div's working. The idea is on the current process you would select someone to assign it to from a dropdown inside that current process and click a button to tell that person. That person will come in and on that process they'll see Accept or Reject buttons and then I'll open up the next process with a dropdown on who to assign again.
I'm having trouble just being able to get stuff to fit inside the process div. Things get all whacky. Ideally because they have "arrows" each process div would be a specific height that I set so it can handle the biggest height requirements inside (when buttons or dropdowns are inside).
I'm also not a huge fan of having to increase the left value by 30 pixels for each div arrow element. Any way to get this same look and feel without having to do that?
.arrow-container > div {
float: left;
}
.arrow-left-done {
display: inline-block;
width: 0;
height: 0;
border-top: 40px solid #d8ffcc;
border-bottom: 40px solid #d8ffcc;
border-left: 40px solid transparent;
}
.arrow-ctr-done {
display: inline-block;
width: 150px;
background: #d8ffcc;
min-height: 80px;
line-height: 80px;
position: relative;
text-align: center;
}
.arrow-right-done {
display: inline-block;
height: 0;
border-top: 40px solid transparent;
border-bottom: 40px solid transparent;
border-left: 40px solid #d8ffcc;
position: relative;
}
.arrow-left-current {
display: inline-block;
width: 0;
height: 0;
border-top: 40px solid #99afff;
border-bottom: 40px solid #99afff;
border-left: 40px solid transparent;
}
.arrow-ctr-current {
display: inline-block;
width: 150px;
background: #99afff;
min-height: 80px;
line-height: 80px;
position: relative;
text-align: center;
}
.arrow-right-current {
display: inline-block;
height: 0;
border-top: 40px solid transparent;
border-bottom: 40px solid transparent;
border-left: 40px solid #99afff;
position: relative;
}
.arrow-left {
display: inline-block;
width: 0;
height: 0;
border-top: 40px solid #EBEBEB;
border-bottom: 40px solid #EBEBEB;
border-left: 40px solid transparent;
}
.arrow-ctr {
display: inline-block;
width: 150px;
background: #EBEBEB;
min-height: 80px;
line-height: 80px;
position: relative;
text-align: center;
}
.arrow-right {
display: inline-block;
height: 0;
border-top: 40px solid transparent;
border-bottom: 40px solid transparent;
border-left: 40px solid #EBEBEB;
position: relative;
}
<div style="display:inline-block;" class="arrow-container">
<div id="zz" class="arrow-ctr-done">
Changed/Tested
Batman
</div>
<div id="zz" class="arrow-right-done"></div>
</div>
<div style="display:inline-block;position:relative;left:-30px" class="arrow-container">
<div id="zz" class="arrow-left-current"></div>
<div id="zz" class="arrow-ctr-current">
Coding Standards
<select>
<option>John Smith</option>
<option>Jane Doe</option>
<option>Howdy Doody</option>
<option>Batman</option>
</select>
<button>Assign</button>
</div>
<div id="zz" class="arrow-right-current"></div>
</div>
<div style="display:inline-block;position:relative;left:-60px" class="arrow-container">
<div id="zz" class="arrow-left"></div>
<div id="zz" class="arrow-ctr">
Manager Approval
</div>
<div id="zz" class="arrow-right"></div>
</div>
<div style="display:inline-block;position:relative;left:-90px" class="arrow-container">
<div id="zz" class="arrow-left"></div>
<div id="zz" class="arrow-ctr">
Implementor
</div>
<div id="zz" class="arrow-right"></div>
</div>
<div style="display:inline-block;position:relative;left:-120px" class="arrow-container">
<div id="zz" class="arrow-left"></div>
<div id="zz" class="arrow-ctr">
Validator
</div>
<div id="zz" class="arrow-right"></div>
</div>

Transparent the background of the text

I'm almost done, but my problem is the background of the text , I even try the opacity but the underline of the box appear.
.block {
display: inline-block;
border: 2px solid white;
padding: 5px;
margin-top: 1em;
}
.paddingbox{
padding: 60px;}
.boxed {
float: left;
color: white;
padding: 0 5px;
margin-top: -2em;
}
<div class="paddingbox"><center>
<div class="block">
<span class="boxed">
<h1 style="color:white;"><?php echo get_the_title(); ?></h1></span>
</div></center></div>
With backgroun color
without background color
I'm trying to achive is like this, but it have a back ground like in the picture above
I tried fieldset and this happen
The behavior can be achieved with a fieldset tag.
.block{
display: inline-block;
border: 2px solid white;
}
.title{
color: white;
font-size: 1.5em;
text-align: center;
}
body{
background: purple;
}
<fieldset class="block">
<legend class="title">
Services
</legend>
</fieldset>
I get help of positions for solve this question!
div {
position: relative;
width: 400px;
padding: 10px;
border: 1px solid;
}
span {
position: absolute;
top: -10px;
left: 40%;
background-color: #FFF;
font-weight: bold;
}
<div>
<span>About Us</span>
</div>

Navigation breadcrumb : using css and html

Please check this image link :
http://postimg.org/image/4iooctxxt/
As you can see, I pointed out the 3 navigation breadcrumb.
How I am able to obtain this with CSS/CSS3 and HTML. How can this be done? If it's possible, how can it be done with a background image.
Try this HTML and CSS:
<html>
<head>
<style>
body
{
margin: auto;
}
#one, #two, #three
{
position: relative;
width: 200px;
height: 40px;
float: left;
background-color: #E6E6E6;
cursor: pointer;
border-top: 1px solid gray;
border-bottom: 1px solid gray;
}
#one
{
border-left: 1px solid gray;
}
#one:after, #two:after, #three:after
{
position: absolute;
width: 0;
height: 0;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
border-left: 10px solid #E6E6E6;
left: 100%;
top: 0px;
content: "";
z-index: 1;
}
#one:hover, #two:hover, #three:hover
{
background-color: #4DB84D;
}
#one:hover:after, #two:hover:after, #three:hover:after
{
border-left: 10px solid #4DB84D;
}
#circle, #text
{
float: left;
}
#circle
{
position: relative;
background-color: white;
color: black;
border-radius: 50%;
width: 21px;
height: 21px;
left: 15px;
top: 50%;
margin-top: -12px;
text-align: center;
border: 1px solid gray;
}
#text
{
position: relative;
left: 20px;
top: 50%;
color: black;
margin-top: -11px;
}
#one:hover #circle, #two:hover #circle, #three:hover #circle
{
background-color: #009900;
color: white;
}
#one:hover #text, #two:hover #text, #three:hover #text
{
color: black;
}
#navigation
{
padding: 40px;
position: absolute;
text-align: center;
background-color: black;
border-radius: 10px;
box-shadow: 0px 0px 10px black;
margin-left: 10px;
margin-top: 10px;
}
</style>
</head>
<body>
<div id="navigation">
<div id="one">
<div id="circle">
<b>1</b>
</div>
<div id="text">
Connect with Facebook
</div>
</div>
<div id="two">
<div id="circle">
<b>2</b>
</div>
<div id="text">
Invite friends
</div>
</div>
<div id="three">
<div id="circle">
<b>3</b>
</div>
<div id="text">
Complete Profile
</div>
</div>
</div>
</body>
</html>
You can copy and paste this to see what happens in a new html document.
You can, of course, modify it to your needs.
EDIT: This is now a full template. To see, create a new html document, copy and paste the code, and open it.
include bootstrap file to your code. example:
<ol class="breadcrumb">
<li>Home</li>
<li>Library</li>
<li class="active">Data</li>
</ol>
it will create breadcrumb

Set a border around coin-slider

I want to place a white border around the slider like this >> .
I tried using .coin-slider img { border: 2px solid white;} , but it didn't work.
Coin-slider link >> Coin-slider official site
HTML:
<div id='coin-slider'>
<img src='images/slideshow1x.png' />
<span>
Description for img01
</span>
<img src='images/slideshow2x.jpg' />
<span>
Description for img01
</span>
<img src='images/slideshow3x.jpg' />
<span>
Description for img01
</span>
<img src='images/slideshow4x.jpg' />
<span>
Description for img01
</span>
</div>
CSS:
.coin-slider { overflow: hidden; zoom: 1; position: relative; }
.coin-slider img { border: 2px solid white;}
/*.coin-slider a{ text-decoration: none; outline: none; border: none; } */
.cs-buttons { font-size: 0px; padding: 10px; float: left; }
/*.cs-buttons a { margin-left: 5px; height: 10px; width: 10px; float: left; border: 1px solid #B8C4CF; color: #B8C4CF; text-indent: -1000px; }*/
.cs-active { background-color: #B8C4CF; color: #FFFFFF;}
.cs-title { width: 545px; padding: 10px; background-color: #000000; color: #FFFFFF; }
.cs-prev,
.cs-next { background-color: #000000; color: #FFFFFF; padding: 0px 10px; }
In your HTML, coin-slider is the id of the div, and not class, whereas in your CSS you are referring to .coin-slider everywhere.
Change <div id='coin-slider'> to <div class='coin-slider'> in your HTML and everything should work fine.
Here is a demo.
White Border for the Coin-Slider can be set by adding the style
border: 2px solid white;
to the Cascading Stylesheet 'coin-slider-style.css' as
.coin-slider {overflow:hidden; zoom:1; position:relative; border:2px solid white;}

Resources