Change the shape of buttons ("arrow-ed" back button) in twitter bootstrap? - css

I would like to know if there is any way to change the shape of a bootstrap button, to get something like this:
Any tips?

You won't get that rounded edge on the tip of the nipple of the button unless you use an image and the :after pseudo-element but you can come close to it by using css triangles. Here is short demo i made that uses some color trickery to come close to that effect:
CSS
button.btn {
position:relative;
}
button.btn:after {
content: " ";
display: block;
width: 0;
height: 0;
border-top: 14px solid transparent;
border-bottom: 14px solid transparent;
border-right: 14px solid #e2e2e2;
position: absolute;
top: 50%;
margin-top: -14px;
right: 98%;
z-index: 2;
}
button.btn:before {
content: " ";
display: block;
width: 0;
height: 0;
border-top: 14px solid transparent;
border-bottom: 14px solid transparent;
border-right: 14px solid #A0A0A0;
position: absolute;
top: 50%;
margin-top: -14px;
right: 97%;
z-index: 1;
}
.btn-primary {
background: #e2e2e2; /* Old browsers */
background: -moz-linear-gradient(left, #e2e2e2 0%, #d1d1d1 47%, #fefefe 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, right top, color-stop(0%,#e2e2e2), color-stop(47%,#d1d1d1), color-stop(100%,#fefefe)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(left, #e2e2e2 0%,#d1d1d1 47%,#fefefe 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left, #e2e2e2 0%,#d1d1d1 47%,#fefefe 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(left, #e2e2e2 0%,#d1d1d1 47%,#fefefe 100%); /* IE10+ */
background: linear-gradient(left, #e2e2e2 0%,#d1d1d1 47%,#fefefe 100%); /* W3C */
text-shadow: 0 -1px 0 #fff;
color:#777;
border: 1px solid #A0A0A0;
}
I did not include the :hover and :active state styles so you can play around mixing some colors by using the Colorzilla gradient generator.
Here is a demo of what the button looks like:
http://jsfiddle.net/WUn26/

Related

How to make rectagle (with triangle from right) border gradient?

I have a problem with CSS3/SVG button. I don't know how to make linear gradient gradient border like that:
Button
Top button: button has transparent background
Bottom button: button on hover has gradient background (same as on border) with opacity 30%, if it is not possible to do such a gradient background when you hover it can change only the color of border
I have created one demo for you. Though you would have to change the colors it looks almost as you wanted it.
To create the gradient you can use this awesome online tool.
.container{
background:blue;
padding:100px;
float:left;
}
.outsider{
padding:4px 0px 4px 4px;
float:left;
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#8887d3+0,cbebff+43,ffffff+100 */
background: rgb(136,135,211); /* Old browsers */
background: -moz-linear-gradient(left, rgba(136,135,211,1) 0%, rgba(203,235,255,1) 43%, rgba(255,255,255,1) 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(left, rgba(136,135,211,1) 0%,rgba(203,235,255,1) 43%,rgba(255,255,255,1) 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to right, rgba(136,135,211,1) 0%,rgba(203,235,255,1) 43%,rgba(255,255,255,1) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#8887d3', endColorstr='#ffffff',GradientType=1 ); /* IE6-9 */
position:relative;
}
.outsider:after{
content: "";
position: absolute;
right: -30px;
width: 0px;
height: 0px;
border-top: 43px solid transparent;
border-bottom: 43px solid transparent;
border-left: 30px solid #FFFFFF;
top: 0px;
}
.outsider:before{
content: "";
position: absolute;
right: -26px;
width: 0px;
height: 0px;
border-top: 39px solid transparent;
border-bottom: 39px solid transparent;
border-left: 26px solid #0000FF;
top: 4px;
z-index: 1;
}
.insider{
padding:30px;
float:left;
color:#FFFFFF;
background:blue;
}
<div class="container">
<div class="outsider">
<div class="insider">
Lorem ipsum dolor silit
</div>
</div>
</div>

How to remove the bottom border of the selected tab in chrome using css

In internet explorer we get a strraight line.in chrome we get distorted lines and rest of all the browsers have the desired case.which is shown by first image. Kindly tell some code to achieve this as i need it very badly. here is the code:
ul#tabs li a {
color: #a09b95;
padding: 6px 15px 7px 15px;
padding: 6px 15px 5px 15px\9; /* IE-only fix */
text-decoration: none;
display: block;
border-bottom: 1px solid #c9c3ba;
border-right: 1px solid #c9c3ba;
/* background-color: #ffffff; */
background: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#f3efeb)); /* Saf4+, Chrome */
background: -webkit-linear-gradient(top, #ffffff, #f3efeb); /* Chrome 10+, Saf5.1+, iOS 5+ */
background: -moz-linear-gradient(top, #ffffff, #f3efeb); /* FF3.6+ */
background: -ms-linear-gradient(#FFFFFF, #F3EFEB); /* IE 8 */
background: -o-linear-gradient(top, #ffffff, #f3efeb); /* Opera 11.10+ */
background: linear-gradient(to bottom, #ffffff, #f3efeb); /* IE9+ */
-pie-background: linear-gradient(#FFFFFF, #F3EFEB); /* IE 6-7 via CSS3Pie */
behavior: url("http://ocw5.mit.edu/styles/pie/PIE.php");
}
ul#tabs li a.selected {
color: #b30838;
border-bottom: 1px solid #fff;
background-color: #fff;
background: none;
-pie-background: none;
behavior: url("http://ocw5.mit.edu/styles/pie/PIE.php");
}
/* Chrome/Safari-only CHP tab border fix */
#media screen and (-webkit-min-device-pixel-ratio:0) {
ul#tabs {
margin: 19px 0 -1px 0;
outline: 0;
}
}
Try this:
ul#tabs li {margin-bottom: -1px;}

CSS3 - divs one on each other, borders, triangles

I'm in trouble trying to do this :
I managed to do something like this :
display: table-cell;
vertical-align: middle;
background: rgb(245,245,245); /* Old browsers */
background: -moz-linear-gradient(top, rgba(245,245,245,1) 0%, rgba(230,230,230,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(245,245,245,1)), color-stop(100%,rgba(230,230,230,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(245,245,245,1) 0%,rgba(230,230,230,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(245,245,245,1) 0%,rgba(230,230,230,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(245,245,245,1) 0%,rgba(230,230,230,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(245,245,245,1) 0%,rgba(230,230,230,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f5f5f5', endColorstr='#e6e6e6',GradientType=0 ); /* IE6-9 */
for the main container of text, and :
width: 0;
height: 0;
border-top: 25px solid transparent;
border-bottom: 25px solid transparent;
border-left: 40px solid #FEEDDD;
display: inline-block;
to do the triangle. I would then place the circle with the number in absolute position inside of it.
But can't figure out how I would do for the triangle "border" to be gradient like the other div, nor giving it a white outer border...
Thanks ahead !
It's definitely possible.
I created not so long ago a back button with a gradient arrow. See this fiddle
So just change the orientation, the colors and resize it to what you want but you've got the idea here I guess.
HTML:
<button>Rejoignez le groupe</button>
CSS:
button {
position: relative;
display: inline-block;
border: 1px solid #555555;
margin: 0;
font-size: 12px;
color: inherit;
cursor: pointer;
height: 30px;
padding: 0 10px;
margin-right: 10px;
font-weight: bold;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #eeeeee), color-stop(100%, #888888));
background: -webkit-linear-gradient(top, #eeeeee, #888888);
background: -moz-linear-gradient(top, #eeeeee, #888888);
background: -o-linear-gradient(top, #eeeeee, #888888);
background: linear-gradient(top, #eeeeee, #888888);
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
-ms-border-radius: 4px;
-o-border-radius: 4px;
border-radius: 4px;
text-shadow: rgba(255, 255, 255, 0.5) 0 1px 0;
-webkit-box-shadow: rgba(255, 255, 255, 0.5) 0 1px 0;
-moz-box-shadow: rgba(255, 255, 255, 0.5) 0 1px 0;
box-shadow: rgba(255, 255, 255, 0.5) 0 1px 0;
}
button:after {
clip: rect(14px, 14px, 28px, 1px);
-webkit-transform: skewX(-35deg);
-moz-transform: skewX(-35deg);
-ms-transform: skewX(-35deg);
-o-transform: skewX(-35deg);
transform: skewX(-35deg);
content: "";
top: 0;
position: absolute;
height: 100%;
width: 8%;
right: -10px;
border-right: inherit;
background: inherit;
-webkit-box-shadow: inherit;
-moz-box-shadow: inherit;
box-shadow: inherit;
}
button:before{
clip: rect(1px, 14px, 14px, 1px);
background: red;
-webkit-transform: skewX(35deg);
-moz-transform: skewX(35deg);
-ms-transform: skewX(35deg);
-o-transform: skewX(35deg);
transform: skewX(35deg);
content: "";
top: 0;
position: absolute;
height: 100%;
width: 8%;
right: -10px;
border-right: inherit;
background: inherit;
-webkit-box-shadow: inherit;
-moz-box-shadow: inherit;
box-shadow: inherit;
}
Tell me if it's too confusing and need some guidance to change orientation, size and colors.
while you probably can manage to do something like that and still maintain a decent fall-backs across the ranges of browsers with successful results... i expect your going to pull out a good chunk of your hair while trying. my suggestion would be to get a few background images made up in Photoshop and break those items up into three different elements
an element for the transparent white circle that can contain the
step #
an element with class for the completed steps to apply the orange gradient background
another element with separate class for the gray gradient
doing things this way you can keep all of your elements "square" without having to worry about support for triangular or circle elements. and just overlay your text in the appropriate places...
i know this might not be exactly what your asking for the css3 way to accomplish everything, but i believe doing things this way allows you to keep it simple & lean

how to put links in one line [CSS]

I have the following links :
<div class="links">
Home
About Me
Contacts<span></span>
Contact Author
<div class="link">
</div>
</div>
with this css file:
.links {
height: 50px;
display: inline;
text-align: center;
padding: 0px 0px 0px 170px;
margin-right: 0px;
margin-top: 7px;
border: none;
line-height: 25px;
}
.links a {
background: #ffffff; /* Old browsers */
background: -moz-linear-gradient(top, #ffffff 0%, #f6f6f6 47%, #ededed 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(47%,#f6f6f6), color-stop(100%,#ededed)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* IE10+ */
background: linear-gradient(to bottom, #ffffff 0%,#f6f6f6 47%,#ededed 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ededed',GradientType=0 ); /* IE6-9 */
color: black;
font-family: Calibri;
font-size: 13px;
text-decoration: none;
padding: 2px 10px;
border: 1px solid #ccc;
}
.links a span {
width: 0;
height: 0;
border-left: 3px solid transparent;
border-right: 3px solid transparent;
border-top: 3px solid #555;
display: inline-block;
margin: 2px 7px;
}
I want the links to show in one line ie: [home] [contacts] [link3] etc
but currently its showing on seperate lines like:
[home][contacts]
[link3]
How can I get them on one line?
You've got display: block assigned to your <a> tags. That will put each one on their own line. Remove that, and they'll be on the same line.

<select> drop arrow doesn't want to go out the container

I'm trying to find a workaround (without using JS) for the firefox bug which doesn't allow to style Firefox dropdown arrow in select elements. Some people say it could be done by putting a select element in a container and setting the container's width to be smaller than the select's. Somehow it just doesn't work for me, even when I set the select element's width to 100000px (the arrow is still there on the max. right position).
http://jsfiddle.net/qQ829/ here is the jsFiddle
CSS:
#nav {
background: url("http://cdn.bavotasan.com/wp-content/uploads/2011/05/down_arrow_select.jpg") no-repeat scroll right center #DDDDDD;
border: 1px solid #CCCCCC;
height: 34px;
overflow: hidden;
max-width: 800px;
border-radius: 12px;
-moz-border-radius: 12px;
-webkit-border-radius: 12px;
border: 1px solid #1C2149;
background: #a7cfdf; /* Old browsers */
background: -moz-linear-gradient(top, #a7cfdf 0%, #1a80b6 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#a7cfdf), color-stop(100%,#1a80b6)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #a7cfdf 0%,#1a80b6 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #a7cfdf 0%,#1a80b6 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #a7cfdf 0%,#1a80b6 100%); /* IE10+ */
background: linear-gradient(to bottom, #a7cfdf 0%,#1a80b6 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a7cfdf', endColorstr='#1a80b6',GradientType=0 ); /* IE6-9 */
}
#nav select {
background: transparent;
width: 830px!important;
padding: 5px;
font-size: 16px;
line-height: 1;
border: 0;
border-radius: 0;
height: 34px;
-webkit-appearance: none;
-moz-appearance: none;
color: white;
font-family: "Open Sans",Arial,Helvetica,sans-serif !important;
}
// EDIT
Additional HTML code:
<nav class="nav-holder" id="nav">
<select>
<option selected="selected" value="">Go to...</option>
</select>
</nav>
add overflow to you css.
#nav select {
background: transparent;
/*width: 830px!important;*/
width:110%;
overflow:hidden;
padding: 5px;
font-size: 16px;
line-height: 1;
border: 0;
border-radius: 0;
height: 34px;
-webkit-appearance: none;
-moz-appearance: none;
color: white;
font-family: "Open Sans",Arial,Helvetica,sans-serif !important;
}
and set the width to 110% as well otherwise you have that long bar
Try with -moz-appearance: window; . It removes all the style of the select (borders and arrow).
You can see it in action here.
Edit: Only for Mac, not for WinXP.
Forget the container, this is how to hide the select arrow on Firefox:
select {
-moz-appearance: none;
text-indent: 0.01px;
text-overflow: '';
}
Live example: http://jsfiddle.net/joaocunha/RUEbp/1/
Whole explanation (worth checking): https://gist.github.com/joaocunha/6273016

Resources