I'm trying to replicate the navigation buttons here, that's a wix website so it's so hard to inspect elements.
What I have tried is here
https://jsfiddle.net/1vngy4uo/1/
I'm trying many variations, never getting the css 100% correct.
.navButton {
width:15%;
display:inline-block;
position:relative;
background-color:#03314b;
border-radius: 30%;
box-shadow: 2px 2px 2px #888888;
}
.navButton:hover {
background-color:#98b7c8;
}
.navButton span {
width:100%;
display:inline-block;
position:absolute;
border-radius: 30%;
box-shadow: 2px 2px 2px #888888;
}
.navButton .bg {
height:50%;
top:0;
background-color:#3a6076 ;
border-radius: 30%;
box-shadow: 2px 2px 2px #888888;
}
.navButton:hover .bg{
background-color:#afcad9;
}
.navButton .text {
position:relative;
text-align:center;
color:#fff;
vertical-align: middle;
align-items: center;
}
.navButton .text:hover {
color:#000000;
}
and html
<a href="contact.html" class="navButton">
<span class="bg"></span>
<span class="text">Contact</span>
A very similar one, using linear-gradient and less HTML markup
jsFiddle
.navButton {
color: white;
text-decoration: none;
font-family: Helvetica, Arial, sans-serif;
font-size: 14px;
text-align: center;
padding: 0 30px;
line-height: 30px;
display: inline-block;
position: relative;
border-radius: 20px;
background-image: linear-gradient(#335b71 45%, #03324c 55%);
box-shadow: 0 2px 2px #888888;
transition: color 0.3s, background-image 0.5s, ease-in-out;
}
.navButton:hover {
background-image: linear-gradient(#b1ccda 49%, #96b4c5 51%);
color: #03324c;
}
Contact
I just used a div element to implement the same button that you referred. Is this what you want?
https://jsfiddle.net/9L60y8c6/
<div class="test">
</div>
.test {
cursor: pointer;
background: rgba(4, 53, 81, 1) url(//static.parastorage.com/services/skins/2.1212.0/images/wysiwyg/core/themes/base/shiny1button_bg.png) center center repeat-x;
border-radius: 10px;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
transition: background-color 0.4s ease 0s;
position: absolute;
top: 0;
bottom: 0;
left: 5px;
right: 5px;
height: 30px;
width: 115px;
}
Would this be a start? You might want to adjust the colors a little.
Note: One can use linear-gradient, though it won't work on IE9, so I use a pseudo instead
.navButton {
width: 15%;
display: inline-block;
position: relative;
background-color: #03314b;
border-radius: 8px;
box-shadow: 2px 2px 2px #888888;
text-align: center;
text-decoration: none;
color: #fff;
padding: 5px;
transition: all 0.3s;
overflow: hidden;
}
.navButton:before {
content: '';
position: absolute;
top: 0;
left: 0;
height: 50%;
width: 100%;
background-color: #335b71;
transition: all 0.3s;
}
.navButton span {
position: relative;
}
.navButton:hover {
transition: all 0.3s;
background-color: #96b4c5;
color: black;
}
.navButton:hover:before {
transition: all 0.3s;
background-color: #b1ccda;
}
<a href="contact.html" class="navButton">
<span>Contact</span>
</a>
Related
I need to create button like this
You can see a rounded borders on center of sides. I'm tried to do it with after and before classes, but it was tricky. Which solution is the cleanest? Also I'm done on dev resizeble button and it'll be better if this can be done as one figure, without absolute positioning or smth like that
body {
background-color: #000;
display: flex;
justify-content: center;
align-items: center;
}
button {
text-transform: uppercase;
background-color: #F9EFCA;
border: none;
padding: 20px 100px;
cursor: pointer;
letter-spacing: 1px;
border-bottom: 10px solid #ae9e5c !important;
box-shadow: inset 0 -1px 1px 0 rgba(0, 0, 0, .12), 0 10px 20px -5px rgba(0, 0, 0, .25);
font-size: 50px;
transition: .2s all;
position: relative;
border-radius: 10px;
}
button:hover,
button:active {
transition: .2s all;
border-bottom: none !important;
}
button:before,
button:after {
content: '';
position: absolute;
top: 9%;
bottom: 0;
height: 91%;
background: #F9EFCA;
width: 10px;
border-radius: 100%;
}
button:before {
left: -4px;
}
button:after {
right: -4px;
}
button:active:before,
button:active:after,
button:hover:before,
button:hover:after {
top: 9%;
bottom: 0;
height: 82%;
}
<button>Call me</button>
Codepen example
create a new button class and try this in your CSS:
.button_costum
{
margin: 10px auto;
font-size: 2.0rem;
padding: 1.25rem 2.5rem;
display: block;
background-color: // choose what you want
border: 1px solid transparent;
color: // choose what you want
font-weight: 300;
-webkit-border-radius: 3px;
border-radius: 20px; // in your case it shout be 25 or 30
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
try using the property on button
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
This would help you target the button corners without distorting the shape of the button itself.
I've been searching the Internet for a while and found nothing, so I'm turning to you guys.
I was wondering how you can do a button like this with CSS (On/Off button example):
I already tried something like this :
HTML :
<a class="button_tooltip" href="#">On</a>
<a class="button_tooltip" href="#">Off</a>
CSS:
a {
color: #76daff;
display: inline-block;
padding: 8px 16px;
position: relative;
text-decoration: none;
}
a {
color: #76daff;
}
a.button_tooltip {
background: #ccc none repeat scroll 0 0;
color: black;
}
a.button_tooltip::after {
border-top-color: #cccccc;
}
a.button_tooltip::after {
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-top: 8px solid #ccc;
content: "";
margin-left: -8px;
}
a.button_tooltip {
background: #cccccc none repeat scroll 0 0;
color: #000000;
}
a.button_tooltip::after {
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-top: 8px solid #ccc;
content: "";
}
a.button_tooltip::after {
border-top-color: #cccccc;
}
But only gave me the square without the little triangle underneath.
This is easily possible with 2 elements and using a pseudo element to get the arrow bit underneath to show.
It doesn't take a great deal of HTML/CSS to complete and can easily be changed to work as an input or as an <a> tag. Whatever your requirements are.
$(document).ready(function() {
$('.btn').click(function() {
$('.btn').toggleClass('active');
});
});
.container {
width: 200px;
height: 100px;
}
.btn {
width: 100px;
height: 100px;
box-sizing: border-box;
border: 1px solid blue;
float: left;
cursor: pointer;
}
.active {
background: blue;
position: relative;
}
.active:before {
content: '';
position: absolute;
width: 50px;
height: 50px;
transform: rotate(45deg);
bottom: -10px;
left: 25px;
background: blue;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="container">
<div class="btn"></div>
<div class="btn active"></div>
</div>
$(document).ready(function() {
$('.toggle-btn button').click(function() {
$(this).parent('.toggle-btn').children('button').removeClass('active');
$(this).addClass('active');
});
});
.toggle-btn {
border: 1px solid #4c8cca;
display: inline-block;
line-height: 1;
width: 100px;
}
button {
line-height: 1;
float: left;
height: 30px;
background: none;
background-color: transparent;
border: none;
padding: 0;
position: relative;
outline: 0;
width: 50%;
cursor: pointer;
}
button:hover {
background-color: #EEE;
}
button.active {
background: #4c8cca;
background-color: #4c8cca;
color: #FFF;
}
button.active:after {
content: '';
position: absolute;
width: 10px;
height: 10px;
top: 25px;
transform: rotate(45deg);
background-color: #4c8cca;
left: 50%;
margin-left: -4px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="toggle-btn">
<button>Yes</button>
<button class="active">No</button>
</div>
Here you go:
http://jsfiddle.net/es_kaija/negzqemp/
<div class="switch off">
<div class="toggle"></div>
<span class="on">ON</span>
<span class="off">OFF</span>
</div>
<style>
.switch {
position: relative;
display: inline-block;
font-size: 1em;
font-weight: bold;
color: #ccc;
text-shadow: 0px 1px 1px rgba(255,255,255,0.8);
height: 18px;
padding: 6px 6px 5px 6px;
border: 1px solid #ccc;
border: 1px solid rgba(0,0,0,0.2);
border-radius: 4px;
background: #ececec;
box-shadow: 0px 0px 4px rgba(0,0,0,0.1), inset 0px 1px 3px 0px rgba(0,0,0,0.1);
cursor: pointer;
}
.switch span { display: inline-block; width: 35px; }
.switch span.On { color: #33d2da; }
.switch .toggle {
position: absolute;
top: 1px;
width: 37px;
height: 25px;
border: 1px solid #ccc;
border: 1px solid rgba(0,0,0,0.3);
border-radius: 4px;
background: #fff;
background: -moz-linear-gradient(top, #ececec 0%, #ffffff 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ececec), color-stop(100%,#ffffff));
background: -webkit-linear-gradient(top, #ececec 0%,#ffffff 100%);
background: -o-linear-gradient(top, #ececec 0%,#ffffff 100%);
background: -ms-linear-gradient(top, #ececec 0%,#ffffff 100%);
background: linear-gradient(top, #ececec 0%,#ffffff 100%);
box-shadow: inset 0px 1px 0px 0px rgba(255,255,255,0.5);
z-index: 999;
-webkit-transition: all 0.15s ease-in-out;
-moz-transition: all 0.15s ease-in-out;
-o-transition: all 0.15s ease-in-out;
-ms-transition: all 0.15s ease-in-out;
}
.switch.on .toggle { left: 2%; }
.switch.off .toggle { left: 54%; }
</style>
<script>
$(document).ready(function() {
// Switch toggle
$('.switch').click(function() {
$(this).toggleClass('on').toggleClass('off');
});
});
</script>
You can do that using css itself. Here is the example - https://jsfiddle.net/p653bpbe/
html
<div class="onoffswitch">
<input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch" checked>
<label class="onoffswitch-label" for="myonoffswitch">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
css
.onoffswitch {
position: relative; width: 90px;
-webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
}
.onoffswitch-checkbox {
display: none;
}
.onoffswitch-label {
display: block; overflow: hidden; cursor: pointer;
border: 1px solid #2E8DEF; border-radius: 0px;
}
.onoffswitch-inner {
display: block; width: 200%; margin-left: -100%;
transition: margin 0.3s ease-in 0s;
}
.onoffswitch-inner:before, .onoffswitch-inner:after {
display: block; float: left; width: 50%; height: 30px; padding: 0; line-height: 26px;
font-size: 14px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold;
box-sizing: border-box;
border: 2px solid transparent;
background-clip: padding-box;
}
.onoffswitch-inner:before {
content: "";
padding-left: 10px;
background-color: #FFFFFF; color: #FFFFFF;
}
.onoffswitch-inner:after {
content: "";
padding-right: 10px;
background-color: #FFFFFF; color: #333333;
text-align: right;
}
.onoffswitch-switch {
display: block; width: 45px; margin: 0px;
background: #2E8DEF;
position: absolute; top: 0; bottom: 0;
transition: all 0.3s ease-in 0s;
}
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
margin-left: 0;
}
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
right: 0px;
}
Button
a { font-size: 0; line-height: 0; text-indent: -4000px; background: #fff; border: 1px solid #007bff; width: 30px; height: 30px; display: block; position: relative; }
a:after { position: absolute; top: -1px; left: 30px; width: 30px; height: 30px; content: ''; display: block; background: #007bff; border: 1px solid #007bff; }
a:before { content: ''; display: block; width: 0; height: 0; border-style: solid; border-width: 10px 10px 0 10px; border-color: #007bff transparent transparent transparent; position: absolute; bottom: -10px; right: -25px; }
I have a DIV with an "arrow" at the bottom, not unlike a speech bubble from a comic book, which appears on the hover state:
The arrow is created with the :after and :before pseudo elements.
I have a transition for the hover for the border color and the box shadow.
My problem is that the "arrow" just "appears". No fade like the other items, but I can't figure out how to target the "arrow". "All" does not look right either.
Ideally, I'd love to have a delay on the arrow and a simple fade or wipe.
Here's the CSS:
.item-selector-button {
position: relative;
text-align: center;
cursor: pointer;
border: 1px solid #cecece;
padding: 15px;
border-radius: 0;
color: #000;
width: 160px;
height: 120px;
transition: all ease-in-out 0.1s, box-shadow ease-in-out 0.1s;
}
.item-selector-button .title {
color: #3e53a4;
font-size: 12px;
margin: 0;
padding-top: -3px;
font-family: "PrecisionSans_W_Md", "Helvetica Neue", Arial, sans-serif;
}
.item-selector-button .divider {
height: 1px;
width: 20px;
background-color: #cecece;
margin: 4px auto 10px;
}
.item-selector-button .image {
background: #fff url("../images/box.png") center center no-repeat;
width: 64px;
height: 57px;
margin: 4px auto;
}
.item-selector-button:hover, .item-selector-button.hover {
padding: 14px;
}
.item-selector-button:hover:after, .item-selector-button.hover:after {
content: "";
position: absolute;
bottom: -12px;
left: 68px;
border-width: 12px 12px 0;
border-style: solid;
border-color: #fff transparent;
transition-delay: 0.3s;
}
.item-selector-button:hover:before, .item-selector-button.hover:before {
content: "";
position: absolute;
bottom: -15px;
left: 65px;
border-width: 15px 15px 0;
border-style: solid;
border-color: #3e53a4 transparent;
transition-delay: 0.3s;
}
.item-selector-button:active, .item-selector-button.active {
border-width: 2px;
border-color: #3e53a4;
background-color: #3e53a4;
}
.item-selector-button:active:before, .item-selector-button.active:before {
content: "";
position: absolute;
bottom: -15px;
left: 65px;
border-width: 15px 15px 0;
border-style: solid;
border-color: #3e53a4 transparent;
transition-delay: 0.3s;
}
.item-selector-button:active .title, .item-selector-button.active .title {
color: #fff;
}
.item-selector-button:active .divider, .item-selector-button.active .divider {
background-color: #fff;
}
.item-selector-button:active .image, .item-selector-button.active .image {
background-color: #3e53a4;
}
.item-selector-button:active:hover, .item-selector-button.active:hover {
padding: 15px;
box-shadow: none;
}
.item-selector-button:active:hover:after, .item-selector-button.active:hover:after {
content: "";
position: absolute;
bottom: -12px;
left: 68px;
border-width: 12px 12px 0;
border-style: solid;
border-color: #3e53a4 transparent;
transition-delay: 0.3s;
}
.item-selector-button.disabled {
pointer-events: none;
cursor: not-allowed;
}
.item-selector-button.disabled .title {
color: #c3c3c3;
}
.item-selector-button.disabled .image {
background-image: url("../images/box-disabled.png");
}
.item-selector-button.disabled:hover {
padding: 15px;
border: 1px solid #cecece;
box-shadow: none;
}
You only have pseudoelements on the hovered element, so there is nothing to transition from/to. You need to add the pseudo elements on the non-hover state element.
Example transitioning visibility:
.item-selector-button:before {
.arrow-inside(...);
transition:all 5s ease;
transition-delay: 0.3s;
visibility:hidden;
}
.item-selector-button:after {
.arrow-outside(...);
transition:all 5s ease;
transition-delay: 0.3s;
visibility:hidden;
}
.item-selector-button:hover:before {
visibility:visible;
}
.item-selector-button:hover:after {
visibility:visible;
}
I can't seem to get the bottom of the buttons to show, I tried increasing padding on the span, setting it to display: block, and increasing the height of the A and SPAN elements to no avail.
JS Fiddle Link: http://jsfiddle.net/7tcrz38r/
CSS:
/* Menu */
div#menu{
float: right;
margin-top: [[setting:menuMarginTop]];
}
div#menu ul{
list-style: none;
margin: 0;
padding: 0;
}
div#menu>ul>li{
float: left;
padding: 0;
}
div#menu li.has-sub>ul{
background: #FFFFFF;
border-top: 4px solid [[setting:color1]] !important;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
height: 110px;
display: none;
height: auto;
margin: -12px 0 0 16px;
padding: 0px;
position: absolute;
width: 170px;
z-index: 2000;
}
div#menu li.has-sub>ul>li{
border-bottom: 1px solid #EEEEEE;
border-left: 1px solid #DDDDDD;
border-right: 1px solid #DDDDDD;
padding: 10px;
}
div#menu li.has-sub>ul>li>a{
color: #949494;
font-size: 12px !important;
text-decoration: none;
}
div#menu li.has-sub>ul>li>a:hover{
color: [[setting:color1]];
}
div#menu li:hover ul {
display: block;
}
div#menu>ul>li>a {
color: #868787;
display: inline-block;
font-size: 18px !important;
font-weight: lighter;
letter-spacing: 1px !important;
margin: 17px 15px !important;
outline: none;
position: relative;
text-decoration: none;
text-shadow: 0 0 1px rgba(255,255,255,0.3);
}
/*div#menu>ul>li>a.active{
color: [[setting:color1]] !important;
background-color: #c3d9e3;
border: 2px solid #abd1eb;
border-radius: 5px;
}*/
div#menu>ul>li:last-child>a{
margin: 17px 0 17px 15px !important
}
div#menu>ul>li:last-child>a{
margin-right: 0 !important;
}
div#menu>ul>li>a:hover,
div#menu>ul>li>a:focus {
outline: none;
}
div#menu>ul>li>a{
overflow: hidden;
padding: 0 !important;
height: 1.3em !important;
}
div#menu>ul>li>a>span {
display: block;
position: relative;
border: 2px solid #eef3f5;
/*-webkit-transition: -webkit-transform 0.3s;
-moz-transition: -moz-transform 0.3s;
transition: transform 0.3s;*/
}
div#menu>ul>li>a>span::before {
position: absolute;
top: 100%;
content: attr(data-hover);
/*-webkit-transform: translate3d(0,0,0);
-moz-transform: translate3d(0,0,0);
transform: translate3d(0,0,0);*/
}
div#menu>ul>li>a:hover span,
div#menu>ul>li>a:focus span {
/* background-color: #c3d9e3;
border: 1px solid #abd1eb;
border-radius: 25%;*/
background-color: #c3d9e3;
border: 2px solid #abd1eb;
border-radius: 5px;
/*-webkit-transform: translateY(-100%);
-moz-transform: translateY(-100%);
transform: translateY(-100%);
color: [[setting:color1]];*/
}
/*
div#menu>ul>li>a.menuactive{
color: [[setting:color1]];
}*/
HTML:
<div id="menu">
<ul><li >
<span data-hover="Home">Home</span></li><li >
<span data-hover="Classes">Classes</span></li><li >
<span data-hover="Pricing">Pricing</span></li><li >
<span data-hover="About Us">About Us</span></li><li >
<span data-hover="Log In">Log In</span></li> </ul>
</div>
You are setting a fixed height(1.3em !important;) for A which is causing this issue.
Please check this updated working fiddle:http://jsfiddle.net/7tcrz38r/2/
you have this declaration:
div#menu>ul>li>a {
overflow: hidden;
padding: 0 !important;
height: 1.3em !important;
}
which, by the way, is repeated since it's declared some lines above
div#menu>ul>li>a {
color: #868787;
display: inline-block;
font-size: 18px !important;
font-weight: lighter;
letter-spacing: 1px !important;
margin: 17px 15px !important;
outline: none;
position: relative;
text-decoration: none;
text-shadow: 0 0 1px rgba(255, 255, 255, 0.3);
}
Anyways, just remove that overflow:hidden property. However, you'll have the menu items showing twice because of that data-hover span you have. I don't know why are you using that, so consider if you need it or not. Of course, you can simply remove that "height: 1.3em !important;" as well, but I assume it's better to have a height than an overflow. anyways, it's a a decision you'll have to ponder
All,
I am trying to build a top menu. For some reason, the li elements are not starting from the top of ul, there appears to be a small margin left at the top. Any explanation please.
jsfiddle: http://jsfiddle.net/K26TN/
HTML Code:
<div id="menu_bars">
<div id="main_bar">
<ul>
<li id="overview_tab" class="maintabs"><a id="text_overview_tab">Overview</a></li><li id="collar_tab" class="maintabs"><a id="text_collar_tab">Collar/ Neckline</a></li><li class="maintabs" id="body_tab"><a id="text_body_tab" >Body</a></li><li id="sleeves_tab" class="maintabs"><a id="text_sleeves_tab" >Sleeves</a></li>
</ul>
</div>
</div>
CSS CODE:
html {
height: 100%;
}
body#container {
position: relative;
width: 100%
min-width: 1280px;
height: 100%;
min-height: 700px;
background-color: rgba(255,255,255,0.8);
margin: 0 auto;
}
#menu_bars {
position: relative;
width: 90%;
height: 20%;
margin: 0 auto;
}
#main_bar {
float: left;
width: 78%;
height: 100%;
}
#main_bar ul {
float: left;
width: 100%;
height: 100%;
border-radius: 6px;
-moz-box-shadow: 0 1px 3px rgba(0,0,0,0.2);
-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.2);
box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.maintabs {
display: inline-block;
width: 25%;
height: 100%;
list-style-type: none;
cursor: pointer;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgb(255,255,255)), color-stop(100%,rgb(237,237,237))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgb(255,255,255) 0%,rgb(237,237,237) 100%); /* Chrome10+,Safari5.1+ */
background: linear-gradient(top, rgb(255,255,255) 0%,rgb(237,237,237) 100%); /* W3C */
}
.maintabs:first-child {
border-top-left-radius: 6px;
border-bottom-left-radius: 6px; }
.maintabs:last-child {
border-top-right-radius: 6px;
border-bottom-right-radius: 6px;
}
.maintabs a {
display: block;
height: 100%;
color: rgb(125,125,125);
line-height: 100%;
font-size: 0.8em;
text-decoration: none;
text-align: center;
text-shadow: 0px 1px 2px rgba(150,150,150,0.4);
-moz-transition: all 0.3s ease-in;
-webkit-transition: all 0.3s ease-in;
-o-transition: all 0.3s ease-in;
transition: all 0.3s ease-in;
}
#overview_tab a{
color: rgb(142,101,143);
text-shadow: 0px 1px 1px rgba(248,248,248,1);
}
.maintabs a:hover {
color: rgb(153,112,154);
text-shadow: 1px 1px 0 rgba(255,255,255,0.95);
}
Your <li> elements are set to display: inline-block, but their vertical-align property defaults to baseline. Specify this in your CSS:
#main_bar li {vertical-align: top}