Related
I have a semi-round button. But I don't know how to bend it for my semi-round button in it's border.
.semi-circle {
display: inline-block;
padding: 9px 16px;
border-radius: 999px !important;
text-align: center;
/*border: 10px solid transparent;*/
/* -moz-border-image: -moz-linear-gradient(right, #FC913A 0%, #FF4E50 100%);
-webkit-border-image: -webkit-linear-gradient(right, #FC913A 0%, #FF4E50 100%);
border-image: linear-gradient(to left, #FC913A 0%, #FF4E50 100%);*/
/*border-image-slice: 1;*/
border: linear-gradient(to right, green 0%, blue 100%);
/*background-image: linear-gradient(to left, #FC913A 0%, #FF4E50 100%);*/
background-image: -o-linear-gradient(to left, #FC913A 0%, #FF4E50 100%);*/
background-image: -moz-linear-gradient(to left, #FC913A 0%, #FF4E50 100%);*/
background-image: -webkit-linear-gradient(to left, #FC913A 0%, #FF4E50 100%);*/
background-image: -ms-linear-gradient(to left, #FC913A 0%, #FF4E50 100%);*/
*/
}
Forgive me for not being able to embed the image because of lack of reputation. Thx for the stack overflow community for its great service.
Here is solution. It works fine in webkit. In other browsers text color is solid.
HTML
<button data-text="Round button"></button>
<button class="active" data-text="Active round button"></button>
CSS
body {
background: #384041;
}
*,
*:before,
*:after {
box-sizing: border-box;
}
button {
display: inline-block;
border: none;
outline: none;
appearance: none;
background: red;
position: relative;
z-index: 3;
height: 60px;
border-radius: 30px;
padding: 0 21px;
font-size: 21px;
box-shadow: -1px -1px 1px 0 black;
background: #4f4f4f;
}
button:before {
content: attr(data-text);
min-width: 144px;
z-index: -1;
border-radius: 27px;
color: #4f4f4f;
}
#media screen and (-webkit-min-device-pixel-ratio:0) { button:before {
background: #4f4f4f;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}}
button:after {
content: '';
position: absolute;
left: 3px;
right: 3px;
top: 3px;
bottom: 3px;
z-index: -2;
border-radius: 30px;
background: #151515;
}
button:hover {
cursor: pointer;
background: linear-gradient(to right, #2084c3 0%, #00caa0 100%);
}
.active {
background: linear-gradient(to right, #2084c3 0%, #00caa0 100%);
}
.active:before{
color: #2084c3;
}
#media screen and (-webkit-min-device-pixel-ratio:0) { .active:before {
background: linear-gradient(to right, #2084c3 0%, #00caa0 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}}
Demo
There are probably better ways to do this, but without further thinking I'd try something like this:
<style type="text/css">
.semi_outer {
padding: 2px;
text-align: center;
border-radius: 11px;
background: linear-gradient(to right, #0f0, #00f);
}
.semi_inner {
margin: 2px;
border-radius: 7px;
background-color: #000;
color: #0f0;
}
.semi_outer:hover {
background: linear-gradient(to right, #c00, #0c0);
}
.semi_outer:active {
background: linear-gradient(to right, #f00, #0f0);
}
</style>
<div class="semi_outer">
<div class="semi_inner">
semi_inner
</div>
</div>
This is your semi-round button . may be it will be helpfull for you.
.outer {
padding: 2px;
text-align: center;
border-radius: 11px;
background: linear-gradient(to right, #0f0, #00f);
width: 200px;
height:30px;
}
.inner {
margin: 3px;
border-radius: 7px;
background-color: #000;
color: #0f0;
height:25px;
}
.outer:hover {
background: linear-gradient(to right, #c00, #0c0);
}
.outer:active {
background: linear-gradient(to right, #f00, #0f0);
}
<div class="outer">
<div class="inner">
BUTTON
</div>
</div>
I'm designing a site for a school project, and I'm trying to design a particular style for the buttons and navigation, but I'm not sure how to go about this.
I considered doing a border effect, but I stopped short as I realized that it doesn't just involve changing individual side's colors but cutting two sides in half and coloring those pieces differently. A gradient on a div behind it might work, but not only would that get complicated, but it would look blurry while I'm going for sharpness like an edge on a 3D shape. Is this doable, or would I have to use images?
EDIT: Wow, looks like there's a lot of methods out there. Code Golf, anyone?
A solution without css gradient if you want to support IE8 too: http://jsfiddle.net/2am780pq/
HTML:
<a class="button">Cool</a>
CSS:
.button {
display: inline-block;
position: relative;
background-color: #4755e7;
padding: 10px 20px;
color: #fff;
}
.button:before {
content: '';
position: absolute;
top: 50%;
bottom: -5px;
left: -5px;
right: -5px;
margin: auto;
background-color: #4451dc;
z-index: -1;
}
.button:after {
content: '';
position: absolute;
top: -5px;
bottom: 50%;
left: -5px;
right: -5px;
margin: auto;
background-color: #5d67e9;
z-index: -1;
}
without gradient nor pseudo-elemts, box-shadow could do the job too:
http://codepen.io/anon/pen/NPaZBd
a{
display: inline-block;
color: #FFF;
padding:5px 1em;
line-height:2em;
background:#4755E7;
margin:1em;
box-shadow:-0.8em -0.8em 0 -0.5em #5d67e9,
0.8em -0.8em 0 -0.5em #5d67e9,
-0.8em 0.8em 0 -0.5em #4451dc,
0.8em 0.8em 0 -0.5em #4451dc;
}
/* add an inside blurry border too ? */
a:nth-child(even) {
box-shadow:-0.8em -0.8em 0 -0.5em #5d67e9,
0.8em -0.8em 0 -0.5em #5d67e9,
-0.8em 0.8em 0 -0.5em #4451dc,
0.8em 0.8em 0 -0.5em #4451dc,
inset 0 0 1px
}
link
link link
link bigger link
link even bigger works still
Yes, with gradient backgrounds and nested elements. This is NOT cross-browser compatible in browsers that do not support CSS3.
Live example: JSFiddle
The HTML:
<span>Click Me</span>
The CSS:
.button {
display: inline-block;
padding: 4px;
background: rgba(115,127,255,1);
background: -moz-linear-gradient(top, rgba(115,127,255,1) 0%, rgba(68,81,220,1) 50%, rgba(68,81,220,1) 51%, rgba(68,81,220,1) 100%);
background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(115,127,255,1)), color-stop(50%, rgba(68,81,220,1)), color-stop(51%, rgba(68,81,220,1)), color-stop(100%, rgba(68,81,220,1)));
background: -webkit-linear-gradient(top, rgba(115,127,255,1) 0%, rgba(68,81,220,1) 50%, rgba(68,81,220,1) 51%, rgba(68,81,220,1) 100%);
background: -o-linear-gradient(top, rgba(115,127,255,1) 0%, rgba(68,81,220,1) 50%, rgba(68,81,220,1) 51%, rgba(68,81,220,1) 100%);
background: -ms-linear-gradient(top, rgba(115,127,255,1) 0%, rgba(68,81,220,1) 50%, rgba(68,81,220,1) 51%, rgba(68,81,220,1) 100%);
background: linear-gradient(to bottom, rgba(115,127,255,1) 0%, rgba(68,81,220,1) 50%, rgba(68,81,220,1) 51%, rgba(68,81,220,1) 100%);
}
.button span {
display: inline-block;
background: #4755E7;
color: #fff;
padding: 0.5em 0.75em;
}
Here one element solution, simplier markup :D
<b>Im sexy and i know it!</b>
http://jsfiddle.net/ebdq20vm/1/
b {
padding: 20px;
display: inline-block;
color: #FFF;
background: #5d67e9;
background: -moz-linear-gradient(top, #5d67e9 50%, #4451dc 51%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(50%, #5d67e9), color-stop(51%, #4451dc));
background: -webkit-linear-gradient(top, #5d67e9 50%, #4451dc 51%);
background: -o-linear-gradient(top, #5d67e9 50%, #4451dc 51%);
background: -ms-linear-gradient(top, #5d67e9 50%, #4451dc 51%);
background: linear-gradient(to bottom, #5d67e9 50%, #4451dc 51%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5d67e9', endColorstr='#4451dc', GradientType=0);
position: relative;
z-index: 5;
}
b:before {
content:'';
position: absolute;
top: 4px;
left: 4px;
right: 4px;
bottom: 4px;
background-color: #4755E7;
display: block;
z-index: -1;
}
I am trying to make my current CSS buttons on my website 2 or 3 times their actual size for mobile devices.. i'm not having much luck
The sytles
.all-news-btn {
background: #666666;
background-image: -webkit-linear-gradient(top, #666666, #333333);
background-image: -moz-linear-gradient(top, #666666, #333333);
background-image: -ms-linear-gradient(top, #666666, #333333);
background-image: -o-linear-gradient(top, #666666, #333333);
background-image: linear-gradient(to bottom, #666666, #333333);
-webkit-border-radius: 3;
-moz-border-radius: 3;
border-radius: 3px;
font-family: Arial !important;
color: #ffffff !important;
font-size: 12px !important;
padding: 7px 8px 7px 7px;
text-decoration: none;
margin-left: 3px;
}
.all-news-btn:hover {
background: #666666;
background-image: -webkit-linear-gradient(top, #666666, #000000);
background-image: -moz-linear-gradient(top, #666666, #000000);
background-image: -ms-linear-gradient(top, #666666, #000000);
background-image: -o-linear-gradient(top, #666666, #000000);
background-image: linear-gradient(to bottom, #666666, #000000);
text-decoration: none;
}
The Media query
#media only screen and (max-device-width: 480px)
{
.all-news-btn {width: 100%; font-size: 4.25em;}
}
Working example
.bt{
background: #333;
color: #fdfdfd;
min-height: 35px;
margin: 0;
border-radius: 3px;
border: 0;
line-height: 35px;
text-align: center;
margin: .5em 0 .5em 0;
}
a.bt{
display: inline;
padding: 7px 10px 7px 10px;
}
.bt:hover{
background: #000;
}
#media only screen and (max-width:480px) {
.bt {
width: 100%;
}
a.bt{
display: block;
padding: 0;
}
}
<button class="bt">Button example</button>
<a class="bt">A example</a>
<input class="bt" type="button" value="Input example"/>
Solving
You can easly solve this issue by adding a min-width attribute to your main button class. Check it out:
In JSFiddle too :)
or Codepen
.all-news-btn {
background: #666666;
background-image: -webkit-linear-gradient(top, #666666, #333333);
background-image: -moz-linear-gradient(top, #666666, #333333);
background-image: -ms-linear-gradient(top, #666666, #333333);
background-image: -o-linear-gradient(top, #666666, #333333);
background-image: linear-gradient(to bottom, #666666, #333333);
-webkit-border-radius: 3;
-moz-border-radius: 3;
border-radius: 3px;
font-family: Arial !important;
color: #ffffff !important;
font-size: 12px !important;
padding: 7px 8px 7px 7px;
text-decoration: none;
margin-left: 3px;
min-width: 100px;
min-height: 30px;
display: inline;
}
.all-news-btn:hover {
background: #666666;
background-image: -webkit-linear-gradient(top, #666666, #000000);
background-image: -moz-linear-gradient(top, #666666, #000000);
background-image: -ms-linear-gradient(top, #666666, #000000);
background-image: -o-linear-gradient(top, #666666, #000000);
background-image: linear-gradient(to bottom, #666666, #000000);
text-decoration: none;
}
#media only screen and (max-width:480px) {
.all-news-btn {width: 100%; font-size: 4.25em; }
}
<button class="all-news-btn">Button example</button>
<input class="all-news-btn" type="button" value="Input example"/>
I've implemented a search bar on my Rails app but it will not pull right for the life of me. With the method I've used, there's a form_tag that seems to overlay the top navbar.
The code for the search bar looks like this:
<%= form_tag search_path, :method => 'get', :class => "form-search", :style => "height:24px;" do %>
<div class="input-append" style="padding-top:5px;">
<%= text_field_tag :search, params[:search], :class=>"span3 watermark search-query", :placeholder => "Search By Device or PIN"%>
<button class="btn" type="submit"><i class="icon-search"></i></button>
</div>
<% end %>
The navbar looks like:
Adding pull-right as a style in any of the tags is not working. Has anyone experienced this problem before?
The Bootstrap CSS override code:
#Wrapper {
margin: 0 auto;
width: 900px;
}
.navbar-fixed-top {
padding-bottom:0px !important;
height:42px;
}
.navbar-inner {
background-color: hsl(27, 94%, 39%) !important;
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#c05a05", endColorstr="#c05a05");
background-image: -khtml-gradient(linear, left top, left bottom, from(#c05a05), to(#c05a05));
background-image: -moz-linear-gradient(top, #c05a05, #c05a05);
background-image: -ms-linear-gradient(top, #c05a05, #c05a05);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #c05a05), color-stop(100%, #c05a05));
background-image: -webkit-linear-gradient(top, #c05a05, #c05a05);
background-image: -o-linear-gradient(top, #c05a05, #c05a05);
background-image: linear-gradient(#c05a05, #c05a05);
border-color: #c05a05 #c05a05 hsl(27, 94%, 39%);
color: #fff !important;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.00);
-webkit-font-smoothing: antialiased;
.border-radius(0) !important;
}
.navbar .brand {
display: block;
float: left;
padding: 10px 20px 10px;
margin-left: -20px;
font-size: 20px;
font-weight: 200;
color: white;
text-shadow: 0 0px 0 #;
}
.navbar .nav > li > a {
color: white;
float: none;
padding: 10px 15px;
text-decoration: none;
text-shadow: 0 0px 0 #ffffff;
}
.navbar .nav > li > a:focus
.navbar .nav > li > a:hover {
color: orange;
text-decoration: none;
background-color: transparent;
}
.container {
max-width:900px;
}
.row-fluid {
max-width:900px;
}
.span3 {
max-width:210px;
}
.well {
background-color: hsl(33, 100%, 93%) !important;
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#ffeedb", endColorstr="#ffeedb");
background-image: -khtml-gradient(linear, left top, left bottom, from(#ffeedb), to(#ffeedb));
background-image: -moz-linear-gradient(top, #ffeedb, #ffeedb);
background-image: -ms-linear-gradient(top, #ffeedb, #ffeedb);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ffeedb), color-stop(100%, #ffeedb));
background-image: -webkit-linear-gradient(top, #ffeedb, #ffeedb);
background-image: -o-linear-gradient(top, #ffeedb, #ffeedb);
background-image: linear-gradient(#ffeedb, #ffeedb);
border-color: #ffeedb #ffeedb hsl(33, 100%, 93%);
color: #333 !important;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.00);
-webkit-font-smoothing: antialiased;
}
.well-thumbnail {
background-color: white;
border-radius: 5px;
padding-top: 5px;
padding-left: 5px;
padding-right: 5px;
}
.row-padded {
padding-top: 10px;
background-color: #B8B8B8;
border: 5px solid #DDD;
margin-top: 10px;
}
.btn-danger {
}
.btn-custom-danger {
background-color: hsl(0, 69%, 22%) !important;
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#b42121", endColorstr="#5e1111");
background-image: -khtml-gradient(linear, left top, left bottom, from(#b42121), to(#5e1111));
background-image: -moz-linear-gradient(top, #b42121, #5e1111);
background-image: -ms-linear-gradient(top, #b42121, #5e1111);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #b42121), color-stop(100%, #5e1111));
background-image: -webkit-linear-gradient(top, #b42121, #5e1111);
background-image: -o-linear-gradient(top, #b42121, #5e1111);
background-image: linear-gradient(#b42121, #5e1111);
border-color: #5e1111 #5e1111 hsl(0, 69%, 17%);
color: #fff !important;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.33);
-webkit-font-smoothing: antialiased;
}
.btn-custom-primary {
background-color: hsl(193, 32%, 49%) !important;
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#b8d3da", endColorstr="#5493a4");
background-image: -khtml-gradient(linear, left top, left bottom, from(#b8d3da), to(#5493a4));
background-image: -moz-linear-gradient(top, #b8d3da, #5493a4);
background-image: -ms-linear-gradient(top, #b8d3da, #5493a4);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #b8d3da), color-stop(100%, #5493a4));
background-image: -webkit-linear-gradient(top, #b8d3da, #5493a4);
background-image: -o-linear-gradient(top, #b8d3da, #5493a4);
background-image: linear-gradient(#b8d3da, #5493a4);
border-color: #5493a4 #5493a4 hsl(193, 32%, 41.5%);
color: #333 !important;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.49);
-webkit-font-smoothing: antialiased;
}
#thumbnail-font{
font-size:small;
}
Thank you.
Try using float:right to sent .form-search to the right of the header.
.form-search {
float:right;
}
I am trying to make a pure css div with arrow ( like speech bubble )
I have created a fiddle here http://jsfiddle.net/ozzy/j9Wku/
Basically, I havent used an image in the fiddle but to the left of the div box when you hover over the image the div animates. You can see effect when you hover over the link.
I want to make it look like a speech bubble, but struggling to accomplish this.
Here is image of what I am after.
Any help greatly appreciated. I only need help doing the arrow for the div.
Easiest way I can think of is using before pseudo class to insert "blank space" before your P tag then style it with borders.
p::before {
display: block;
position: absolute;
top: 18px;
left: -10px;
content: '';
border-top: 10px solid transparent;
border-right: 10px solid #eeeeee;
border-bottom: 10px solid transparent;
}
http://jsfiddle.net/j9Wku/6/
I fiddled with this myself, and came up with a great solution. Code below.
.logo-heading {
position:absolute;
font-size:12px;
margin-left:230px;
float:left;
line-height:16px;
color:#404040;
background: rgb(255,255,255);
background: -moz-linear-gradient(left, rgba(255,255,255,1) 0%, rgba(238,238,238,1) 100%);
background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(255,255,255,1)), color-stop(100%,rgba(238,238,238,1)));
background: -webkit-linear-gradient(left, rgba(255,255,255,1) 0%,rgba(238,238,238,1) 100%);
background: -o-linear-gradient(left, rgba(255,255,255,1) 0%,rgba(238,238,238,1) 100%);
background: -ms-linear-gradient(left, rgba(255,255,255,1) 0%,rgba(238,238,238,1) 100%);
background: linear-gradient(left, rgba(255,255,255,1) 0%,rgba(238,238,238,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee',GradientType=1 );
top:38px;
padding:5px;
border-width:1px;
border-color: #cccccc #F6F6F6 #F6F6F6 #cccccc;
border-style:solid;
border-radius:3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
text-shadow: 1px 1px 0 #fff;
}
.logo-heading2{
position:absolute;
font-size:12px;
margin-left:230px;
float:left;
line-height:16px;
display:none;
color:#404040;
background: rgb(255,255,255);
background: -moz-linear-gradient(left, rgba(255,255,255,1) 0%, rgba(238,238,238,1) 100%);
background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(255,255,255,1)), color-stop(100%,rgba(238,238,238,1)));
background: -webkit-linear-gradient(left, rgba(255,255,255,1) 0%,rgba(238,238,238,1) 100%);
background: -o-linear-gradient(left, rgba(255,255,255,1) 0%,rgba(238,238,238,1) 100%);
background: -ms-linear-gradient(left, rgba(255,255,255,1) 0%,rgba(238,238,238,1) 100%);
background: linear-gradient(left, rgba(255,255,255,1) 0%,rgba(238,238,238,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee',GradientType=1 );
top:38px;
padding:5px;
border-width:1px;
border-color: #cccccc #F6F6F6 #F6F6F6 #cccccc;
border-style:solid;
border-radius:3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
text-shadow: 1px 1px 0 #fff;
}
#tail1 {
width: 0px;
height: 0px;
border: 10px solid;
border-color: transparent #f0f0f0 transparent transparent;
position:absolute;
top: 14px;
left: -21px;
}
#tail2 {
width: 0px;
height: 0px;
border: 10px solid;
border-color: transparent #ffffff transparent transparent;
position:absolute;
left: -20px;
top: 14px;
}
Changed a couple of things in the js and works perfect. Thanks guys
ther is an example
http://jsfiddle.net/amkrtchyan/j9Wku/7/
i try it with canvas