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; }
Related
The slider in Firefox looked gray by default. As far as I understand, Firefox does not accept many css tags, such as input[type=range]::-webkit-slider-thumb, as an example, I tried adding moz-range-thumb tags to the existing CSS, something like I managed to do it, but still the background of the slider is white, and this is only in Firefox.
How it looks after changes:
And my css code:
input[type=range] {
-webkit-appearance: none;
width: 100%;
}
input[type=range]:focus {
outline: none;
}
input[type=range]:focus::-webkit-slider-runnable-track {
background: linear-gradient(
90deg
,#29bddd,#923ddd),#c4c4c4;
}
input[type=range]:focus::-ms-fill-lower {
background: linear-gradient(
90deg
,#29bddd,#923ddd),#c4c4c4;
}
input[type=range]:focus::-ms-fill-upper {
background: linear-gradient(
90deg
,#29bddd,#923ddd),#c4c4c4;
}
input[type=range]::-webkit-slider-runnable-track {
width: 100%;
height: 5px;
cursor: pointer;
animate: 0.2s;
background: linear-gradient(
90deg
,#29bddd,#923ddd),#c4c4c4;
border-radius: 1px;
box-shadow: none;
border: 0;
}
input[type=range]::-webkit-slider-thumb {
z-index: 2;
position: relative;
box-shadow: 0px 0px 0px #000;
border: 1px solid #2497e3;
height: 18px;
width: 18px;
border-radius: 25px;
background: #a1d0ff;
cursor: pointer;
-webkit-appearance: none;
margin-top: -7px;
}
input[type=range]::-moz-range-thumb {
z-index: 2;
position: relative;
box-shadow: 0px 0px 0px #000;
border: 1px solid #2497e3;
height: 18px;
width: 18px;
border-radius: 25px;
background: #a1d0ff;
cursor: pointer;
-webkit-appearance: none;
margin-top: -7px;
}
input[type=range]::-moz-range-track {
width: 100%;
height: 5px;
cursor: pointer;
animate: 0.2s;
background: linear-gradient(
90deg
,#29bddd,#923ddd),#c4c4c4;
border-radius: 1px;
box-shadow: none;
border: 0;
}
input[type=range]:-moz-focusring {
outline: none;
}
input[type=range]:focus::-moz-range-track {
background: linear-gradient(
90deg
,#29bddd,#923ddd),#c4c4c4;
}
How i can remove this white background in Firefox browser?
In addition to adding background for input[type=range].
you can set height = 0 for input[type=range].
body{
background:gray;
}
input[type=range] {
-webkit-appearance: none;
width: 100%;
height:0;
/* background:none; */
}
input[type=range]:focus {
outline: none;
}
input[type=range]:focus::-webkit-slider-runnable-track {
background: linear-gradient(
90deg
,#29bddd,#923ddd),#c4c4c4;
}
input[type=range]:focus::-ms-fill-lower {
background: linear-gradient(
90deg
,#29bddd,#923ddd),#c4c4c4;
}
input[type=range]:focus::-ms-fill-upper {
background: linear-gradient(
90deg
,#29bddd,#923ddd),#c4c4c4;
}
input[type=range]::-webkit-slider-runnable-track {
width: 100%;
height: 5px;
cursor: pointer;
animate: 0.2s;
background: linear-gradient(
90deg
,#29bddd,#923ddd),#c4c4c4;
border-radius: 1px;
box-shadow: none;
border: 0;
}
input[type=range]::-webkit-slider-thumb {
z-index: 2;
position: relative;
box-shadow: 0px 0px 0px #000;
border: 1px solid #2497e3;
height: 18px;
width: 18px;
border-radius: 25px;
background: #a1d0ff;
cursor: pointer;
-webkit-appearance: none;
margin-top: -7px;
}
input[type=range]::-moz-range-thumb {
z-index: 2;
position: relative;
box-shadow: 0px 0px 0px #000;
border: 1px solid #2497e3;
height: 18px;
width: 18px;
border-radius: 25px;
background: #a1d0ff;
cursor: pointer;
-webkit-appearance: none;
margin-top: -7px;
}
input[type=range]::-moz-range-track {
width: 100%;
height: 5px;
cursor: pointer;
animate: 0.2s;
background: linear-gradient(
90deg
,#29bddd,#923ddd),#c4c4c4;
border-radius: 1px;
box-shadow: none;
border: 0;
}
input[type=range]:-moz-focusring {
outline: none;
}
input[type=range]:focus::-moz-range-track {
background: linear-gradient(
90deg
,#29bddd,#923ddd),#c4c4c4;
}
<input type="range">
You should just set the background for input[type=range].
Here's a simplified example:
input[type=range] {
-webkit-appearance: none;
width: 500px;
height: 20px;
background: pink;
}
/* Firefox */
input[type=range]::-moz-range-thumb {
background: blue;
}
input[type=range]::-moz-range-track {
background: purple;
}
/* Chrome */
input[type=range]::-webkit-slider-thumb {
background: blue;
margin-top: -5px;
}
input[type=range]::-webkit-slider-runnable-track {
background: purple;
height: 5px;
}
<input type="range" />
The screenshot attached explains everything about the desired effect. I was thinking to decrease the border width from 4px to 3px to 2px , I don't want to apply ease-in/ease out effect. As of now, when I hover, it looks like this. I want to change this box through the effect displayed in the first screenshot.
For reference,
I am posting the code below:
&__link {
#include font-text(default, menuitem);
#include token(font-size, sidenav, default);
background-image: none;
text-transform: uppercase;
padding: 1rem;
margin: 0;
&:before {
position: absolute;
right: 1.3rem;
top: 2rem;
width: 1px;
content: '';
background: #fff;
height: 100%;
opacity: 0.3;
}
&:after {
display: inline-block;
vertical-align: middle;
position: relative;
content: '';
width: 10px;
height: 10px;
outline: 1px solid #fff;
top: -1px;
}
&:hover {
#include font-text(default, menuitem);
#include token(font-size, sidenav, hover);
font-weight: 600;
margin: 0;
padding: 1rem;
&:after {
background: white;
box-shadow: 0 0 10px 1px rgba(255, 255, 255, 1);
}
}
}
&:after represents the code for the box. Thanks in advance.
<div class="box">
</div>
.box {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
height: 200px;
width: 200px;
text-decoration: none;
background-color: white;
background-image: linear-gradient(#000, #000);
border: 1px solid black;
background-position: 50% 50%;
background-repeat: no-repeat;
background-size: 0% 0%;
transition: .5s;
}
.box:hover {
background-size: 95% 95%;
}
Didnt understand the question too well but this does the attached screenshot animation
Try it - you need to set animations, bcz you want several situations for single event (hover)
Replace these blocks
&:after {
display: inline-block;
vertical-align: middle;
position: relative;
content: '';
width: 0px;
height: 0px;
top: -1px;
background: white;
border: 7px solid #fff;
}
&:hover:after {
animation: sqr .3s linear;
animation-fill-mode: forwards;
}
#keyframes sqr {
30%{
border: 5.5px solid #fff;
width: 3px; height: 3px;
background: black;
}
80%{
border: 4px solid #fff;
width: 6px;
height: 6px;
background: black;
}
100%{
border: 3px solid #fff;
width: 8px;
height: 8px;
transform: scale(1.5);
box-shadow: 0 0 5px 2px #fff;
background: black;
}
}
I have tried a lot but unable to figure out whats wrong. The z-index is not working at all when hovering over the Available Balance question mark (?). Upon hover over the question mark (?), it can be noticed that the tooltip is getting cut by the table heading area. Can someone please guide me what needs to be changed? Here is the complete code I am working with. Sorry for the long code but I have tried to put in as much as I can for some one to figure this out.
/* SECONDARY TOOLTIP (S) */
[tooltip] {
position: relative;
}
/* Arrow */
[tooltip]:before {
width: 16px;
height: 6px;
left: 50%;
margin-top: 1px;
top: calc(100% - 10px);
opacity: 1;
content: '';
position: absolute;
z-index: 10;
box-sizing: border-box;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-bottom: 10px solid #00204e;
transform: translate(-50%, 0%);
opacity: 0;
-webkit-transition: all 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);
-moz-transition: all 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);
-ms-transition: all 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);
-o-transition: all 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);
transition: all 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);
pointer-events: none;
}
/* Text */
[tooltip]:after {
transform: translate(-50%, 0%);
left: 50%;
margin-top: 11px;
top: calc(100% - 10px);
opacity: 1;
font-weight: normal;
text-shadow: none;
background: #00204e;
border-radius: 4px;
color: #fff;
content: attr(tooltip);
padding: 10px;
position: absolute;
white-space: normal;
width: max-content;
font-size: 9px;
font-family: 'Helvetica Neue';
line-height: normal;
max-width: 150px;
text-align: left;
height: auto;
display: inline-block;
opacity: 0;
-webkit-transition: all 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);
-moz-transition: all 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);
-ms-transition: all 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);
-o-transition: all 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);
transition: all 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);
pointer-events: none;
/* overflow: overlay; */
z-index: 999999;
}
[tooltip]:hover:before,
[tooltip]:hover:after {
opacity: 1;
pointer-events: auto;
top: calc(100% + 0px);
z-index: 99999;
overflow: visible;
position: absolute;
}
/* SECONDARY TOOLTIP (E) */
.claro .dojoxGridHeader:first-child .dojoxGridRowTable {
border-left-width: 0;
}
.claro .dojoxGridMasterHeader .dojoxGridRowTable {
border-left: 1px solid #BCBCBC;
border-right: 1px solid white;
background-color: transparent;
}
.base .dojoxGridRowTable {
height: 30px !important;
word-wrap: break-word;
}
table.dojoxGridRowTable {
table-layout: auto;
}
.dojoxGridHeader table {
text-align: center;
}
.dojoxGrid table {
padding: 0;
}
.dojoxGridRowTable {
table-layout: fixed;
width: 0;
empty-cells: show;
}
table {
font-size: 100%;
}
table[Attributes Style] {
border-top-width: 0px;
border-right-width: 0px;
border-bottom-width: 0px;
border-left-width: 0px;
-webkit-border-horizontal-spacing: 0px;
-webkit-border-vertical-spacing: 0px;
}
user agent stylesheet
table {
display: table;
border-collapse: separate;
border-spacing: 2px;
border-color: grey;
}
.claro .dojoxGridHeader:first-child {
/* margin-left: -50px; */
text-align: left;
margin: 0px -1px;
}
.dojoxGridHeader {
position: absolute;
overflow: hidden;
cursor: default;
}
.base .dojoxGrid {
background-color: #FFFFFF;
font-size: 12px;
color: #00204e;
padding: 0px 1px 20px 0px;
border-top: 0px;
height: 40px;
/* margin-top: 115px; */
/* border-top: solid 1px #D0D0D0; */
/* border-bottom: solid 1px #D0D0D0; */
/* margin-bottom: 20px; */
width: 100%;
/* width: 647px; */
/* height: 226px !important; */
}
.base .dojoxGrid {
background-color: transparent;
border-width: 1px 0 0 0;
font-size: 1em;
}
.base .dojoxGrid {
font-size: 0.916em;
}
.dojoxGrid {
position: relative;
background-color: #EBEADB;
font-family: Geneva, Arial, Helvetica, sans-serif;
-moz-outline-style: none;
outline: none;
overflow: hidden;
height: 0;
}
.portlet {
margin: 4px 0 30px 0;
padding: 0;
font-size: 0.75em;
}
body {
/* font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; */
font-size: 14px;
color: #00204c;
/* margin-left: 125px; */
margin: 0 auto;
}
tbody {
display: table-row-group;
vertical-align: middle;
border-color: inherit;
}
.base .dojoxGridRowTable {
height: 30px !important;
word-wrap: break-word;
}
.dojoxGridHeader table {
text-align: center;
}
.dojoxGridRowTable {
table-layout: fixed;
width: 0;
empty-cells: show;
}
table {
font-size: 100%;
}
table {
display: table;
border-collapse: separate;
border-spacing: 2px;
border-color: grey;
}
.claro .dojoxGridHeader:first-child {
/* margin-left: -50px; */
text-align: left;
margin: 0px -1px;
}
.dojoxGridHeader {
position: absolute;
overflow: hidden;
cursor: default;
}
.base .dojoxGrid {
background-color: #FFFFFF;
font-size: 12px;
color: #00204e;
padding: 0px 1px 20px 0px;
border-top: 0px;
height: 40px;
/* margin-top: 115px; */
/* border-top: solid 1px #D0D0D0; */
/* border-bottom: solid 1px #D0D0D0; */
/* margin-bottom: 20px; */
width: 100%;
/* width: 647px; */
/* height: 226px !important; */
}
.base .dojoxGrid {
background-color: transparent;
border-width: 1px 0 0 0;
font-size: 1em;
}
.base .dojoxGrid {
font-size: 0.916em;
}
.dojoxGrid {
position: relative;
background-color: #EBEADB;
font-family: Geneva, Arial, Helvetica, sans-serif;
-moz-outline-style: none;
outline: none;
overflow: hidden;
height: 0;
}
.claro .dojoxGridHeader .dojoxGridRowTable tr {
background: none;
}
.claro .dojoxGridRowTable tr {
background: url(images/row_back.png) #fff repeat-x;
}
tr {
display: table-row;
vertical-align: inherit;
border-color: inherit;
}
.base .dojoxGridRowTable {
height: 30px !important;
word-wrap: break-word;
}
.dojoxGridHeader table {
text-align: center;
}
.dojoxGridRowTable {
table-layout: fixed;
width: 0;
empty-cells: show;
}
table {
font-size: 100%;
}
table {
display: table;
border-collapse: separate;
border-spacing: 2px;
border-color: grey;
}
.claro .dojoxGridHeader:first-child {
/* margin-left: -50px; */
text-align: left;
margin: 0px -1px;
}
.dojoxGridHeader {
position: absolute;
overflow: hidden;
cursor: default;
}
.base .dojoxGrid {
background-color: #FFFFFF;
font-size: 12px;
color: #00204e;
padding: 0px 1px 20px 0px;
border-top: 0px;
height: 40px;
/* margin-top: 115px; */
/* border-top: solid 1px #D0D0D0; */
/* border-bottom: solid 1px #D0D0D0; */
/* margin-bottom: 20px; */
width: 100%;
/* width: 647px; */
/* height: 226px !important; */
}
.base .dojoxGrid {
background-color: transparent;
border-width: 1px 0 0 0;
font-size: 1em;
}
.base .dojoxGrid {
font-size: 0.916em;
}
.dojoxGrid {
position: relative;
background-color: #EBEADB;
font-family: Geneva, Arial, Helvetica, sans-serif;
-moz-outline-style: none;
outline: none;
overflow: hidden;
height: 0;
}
#AccountSummarySavingsListPortlet th[idx="3"], #AccountSummarySavingsListPortlet td[idx="3"] {
text-align: right !important;
}
.claro .dojoxGridHeader tr:first-child .dojoxGridCell {
border-top: 1px solid transparent;
}
.base .dojoxGridHeader th.dojoxGridCell {
background: none repeat scroll 0 0 #FFFFFF;
font-size: 1em;
font-weight: bold;
color: #00204e;
border-bottom: thin;
border-bottom-style: solid;
border-bottom-color: #D0D0D0;
height: 20px;
text-align: left !important;
/* white-space: nowrap !important; */
padding: 15px 0px;
}
.base .dojoxGridHeader th.dojoxGridCell {
background: none repeat scroll 0 0 #7692B7;
}
.base .dojoxGridHeader .dojoxGridCell {
padding: 5px;
}
.base .dojoxGridHeader .dojoxGridCell {
border: 1px solid #fff;
font-weight: bold;
color: #fff;
}
.base .dojoxGridHeader .dojoxGridCell {
text-align: center;
}
.claro .dojoxGridHeader .dojoxGridCell {
padding: 2px 5px;
background: transparent;
border-bottom: 1px solid #BCBCBC;
border-top: 1px solid white;
border-left: 1px solid white;
border-right: 1px solid #BCBCBC;
vertical-align: top;
}
.claro .dojoxGridHeader .dojoxGridCell {
background: url(images/header.png) #e5edf4 repeat-x top;
border-style: solid;
border-width: 1px;
border-color: #BCBCBC #BCBCBC #BCBCBC transparent;
}
.base .dojoxGrid th {
text-align: center;
}
.base .dojoxGridCell {
border: none;
/* padding-left: 0px; */
}
.base .dojoxGridCell {
border: none;
/* padding-left: 0px; */
}
.base .dojoxGridCell {
border: 1px solid #fff;
padding-left: 3px !important;
}
.claro .dojoxGridCell, .claro .dojoxGridCellFocus {
outline: none;
}
.claro .dojoxGridCell {
padding: 3px 5px;
border-color: transparent #E5DAC8 #E5DAC8 transparent;
}
.claro .dojoxGridCell {
padding: 0px;
border: 1px solid transparent;
}
.base .dojoxGridHeader th.dojoxGridCell {
background: none repeat scroll 0 0 #FFFFFF;
font-size: 1em;
font-weight: bold;
color: #00204e;
border-bottom: thin;
border-bottom-style: solid;
border-bottom-color: #D0D0D0;
height: 20px;
text-align: left !important;
/* white-space: nowrap !important; */
padding: 15px 0px;
}
.base .dojoxGridHeader th.dojoxGridCell {
background: none repeat scroll 0 0 #7692B7;
}
.base .dojoxGridHeader .dojoxGridCell {
padding: 5px;
}
.base .dojoxGridHeader .dojoxGridCell {
border: 1px solid #fff;
font-weight: bold;
color: #fff;
}
.base .dojoxGridHeader .dojoxGridCell {
text-align: center;
}
.claro .dojoxGridHeader .dojoxGridCell {
padding: 2px 5px;
background: transparent;
border-bottom: 1px solid #BCBCBC;
border-top: 1px solid white;
border-left: 1px solid white;
border-right: 1px solid #BCBCBC;
vertical-align: top;
}
.claro .dojoxGridHeader .dojoxGridCell {
background: url(images/header.png) #e5edf4 repeat-x top;
border-style: solid;
border-width: 1px;
border-color: #BCBCBC #BCBCBC #BCBCBC transparent;
}
.base .dojoxGrid th {
text-align: center;
}
.base .dojoxGridCell {
border: none;
/* padding-left: 0px; */
}
.base .dojoxGridCell {
border: none;
/* padding-left: 0px; */
}
.base .dojoxGridCell {
border: 1px solid #fff;
padding-left: 3px !important;
}
.claro .dojoxGridCell, .claro .dojoxGridCellFocus {
outline: none;
}
.claro .dojoxGridCell {
padding: 3px 5px;
border-color: transparent #E5DAC8 #E5DAC8 transparent;
}
.claro .dojoxGridCell {
padding: 0px;
border: 1px solid transparent;
}
.dojoxGridHeader .dojoxGridCell {
border: 1px solid;
border-color: #F6F4EB #ACA899 #ACA899 #F6F4EB;
background: url(images/grid_dx_gradient.gif) #E8E1CF top repeat-x;
padding-bottom: 2px;
}
.dojoxGridCell {
border: 1px solid;
border-color: #EBEADB;
border-right-color: #D5CDB5;
padding: 3px 3px 3px 3px;
text-align: left;
overflow: hidden;
}
caption, th {
text-align: left;
}
address, caption, cite, code, dfn, th, var {
font-style: normal;
font-weight: normal;
}
body, div, dl, dt, dd, li, h1, h2, h3, h4, h5, h6, pre, form, fieldset, input, textarea, p, blockquote, th, td {
/* margin: 0; */
padding: 0;
}
th {
font-weight: bold;
text-align: -internal-center;
}
table {
font-size: 100%;
}
/*------------------------------------------ */
table {
display: table;
border-collapse: separate;
border-spacing: 2px;
border-color: grey;
}
#A_12 {
border: 1px solid #00204e;
border-radius: 50%;
}
<table class="dojoxGridRowTable" border="0" cellspacing="0" cellpadding="0" role="presentation" style="width: 1001px;" id="TABLE_1"><tbody id="TBODY_2"><tr id="TR_3"><th tabindex="-1" aria-readonly="true" role="columnheader" id="TH_4" class="dojoxGridCell dojoDndItem dojoxGridCellFocus" idx="0" style="text-align: center;text-align: center;width:30%;" dndtype="gridColumn_grid1522757357169402654"><div class="dojoxGridSortNode" id="DIV_5">Account</div></th><th tabindex="-1" aria-readonly="true" role="columnheader" id="TH_6" class="dojoxGridCell dojoDndItem" idx="1" style="text-align: center;text-align: center;width:5%;" dndtype="gridColumn_grid1522757357169402654"><div class="dojoxGridSortNode" id="DIV_7">Currency</div></th><th tabindex="-1" aria-readonly="true" role="columnheader" id="TH_8" class="dojoxGridCell dojoDndItem" idx="2" style="text-align: right;text-align: center;width:12%;" dndtype="gridColumn_grid1522757357169402654"><div class="dojoxGridSortNode" id="DIV_9">Pending balance</div></th><th tabindex="-1" aria-readonly="true" role="columnheader" id="TH_10" class="dojoxGridCell dojoDndItem" idx="3" style="text-align: right;text-align: center;width:12%;" dndtype="gridColumn_grid1522757357169402654"><div class="dojoxGridSortNode" id="DIV_11">Available balance</div><a tooltip="this is a test" style="
position: relative;
text-align: center;
width: 100%;
display: block;
/* overflow: visible; */
" id="A_12">?</a>
</th><th tabindex="-1" aria-readonly="true" role="columnheader" id="TH_13" class="dojoxGridCell dojoDndItem" idx="4" style="text-align: center;text-align: center;width:12%;" dndtype="gridColumn_grid1522757357169402654"><div class="dojoxGridSortNode" id="DIV_14">Accrued Interest Rate</div></th><th tabindex="-1" aria-readonly="true" role="columnheader" id="TH_15" class="dojoxGridCell dojoDndItem" idx="5" style="text-align: center;text-align: center;width:10%;" dndtype="gridColumn_grid1522757357169402654"><div class="dojoxGridSortNode" id="DIV_16">Active</div></th><th tabindex="-1" aria-readonly="true" role="columnheader" id="TH_17" class="dojoxGridCell dojoDndItem " idx="6" style="text-align: center;text-align: center;width:12%;" dndtype="gridColumn_grid1522757357169402654"><div class="dojoxGridSortNode" id="DIV_18">Interest Rate</div></th></tr></tbody></table>
because overflow is hidden in class .dojoxGridCell
set overflow to inherit
.dojoxGridCell {
border: 1px solid;
border-color: #EBEADB;
border-right-color: #D5CDB5;
padding: 3px 3px 3px 3px;
text-align: left;
overflow: inherit;
}
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>
Basically, the image below summarizes my question.
Is there any elegant solution to make it work? I've tried to use rotate, skew and perspective, but didn't work for me.
Note: the background needs to be transparent.
My code for you. :)
* { box-sizing: border-box; }
body { font: normal 16px sans-serif; }
.spaceship {
height: 430px;
position: relative;
width: 140px;
}
.spaceship::before {
background: #006dd9;
border-radius: 100%;
content: '';
height: 70px;
position: absolute;
width: 140px;
z-index: 1;
}
.abduction {
background: #0f0;
height: 370px;
left: 20px;
padding-top: 10px;
position: absolute;
top: 60px;
width: 100px;
}
.abduction a {
color: #fff;
display: block;
height: 60px;
padding-top: 25px;
text-align: center;
text-decoration: none;
text-transform: uppercase;
transition: background 500ms;
}
.abduction a:nth-child(even) { background: #00d900; }
.abduction a:hover { background: #008c00; }
<div class="spaceship">
<div class="abduction">
Button 1
Button 2
Button 3
Button 4
Button 5
Button 6
</div>
</div>
Here's what I changed your css to make it look like your picture and do the correct hover effect:
* { box-sizing: border-box; }
body { font: normal 16px sans-serif; }
.spaceship {
height: 430px;
position: relative;
width: 140px;
}
.spaceship::before {
background: #006dd9;
border-radius: 100%;
content: '';
height: 70px;
position: absolute;
width: 140px;
z-index: 1;
}
.abduction {
height: 370px;
left: 20px;
padding-top: 5px;
position: absolute;
top: 60px;
width: 100px;
}
.abduction a {
color: #fff;
display: block;
height: 65px;
margin: 0 auto;
padding: 0;
border-bottom: 65px solid #0f0;
border-left: 3px solid transparent;
border-right: 3px solid transparent;
line-height: 5;
font-size: 12px;
text-align: center;
text-decoration: none;
text-transform: uppercase;
transition: border-bottom-color 500ms;
}
.abduction a:nth-child(5){
width: 94px;
}
.abduction a:nth-child(4){
width: 88px;
}
.abduction a:nth-child(3){
width: 82px;
}
.abduction a:nth-child(2){
width: 76px;
}
.abduction a:nth-child(1){
width: 70px;
}
.abduction a:nth-child(even) { border-bottom-color: #00d900; }
.abduction a:hover { border-bottom-color: #008c00; }
<div class="spaceship">
<div class="abduction">
Button 1
Button 2
Button 3
Button 4
Button 5
Button 6
</div>
</div>
So basically to create a 65px high trapezoid with borders (colored #0f0) you'd do this:
border-bottom: 65px solid #0f0;
border-left: 3px solid transparent;
border-right: 3px solid transparent;
The width of the last element is 100px. So since the left border width + the right border width = 6px and 100px - 6px = 94px, the second to last element will have a width of 94px to match the top of the last element. You subtract the side border sum from the previous elements width to get the current element width.
Also the transition property needs to be changed to border-bottom-color instead of background because border-bottom-color is what sets the color of the trapezoid.
* { box-sizing: border-box; }
body { font: normal 16px sans-serif; }
.spaceship {
height: 430px;
position: relative;
width: 140px;
}
.spaceship::before {
background: #006dd9;
border-radius: 100%;
content: '';
height: 70px;
position: absolute;
width: 140px;
z-index: 1;
}
.abduction {
height: 370px;
left: 15px;
padding-top: 10px;
position: absolute;
top: 50px;
width: 110px;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 400px solid #0f0;
}
.abduction a {
color: #fff;
display: block;
height: 60px;
padding-top: 25px;
text-align: center;
text-decoration: none;
text-transform: uppercase;
transition: background 500ms;
}
.abduction a:nth-child(even) { background: #00d900; }
.abduction a:hover { background: #008c00; }
<div class="spaceship">
<div class="abduction">
Button 1
Button 2
Button 3
Button 4
Button 5
Button 6
</div>
</div>
I'm pretty sure you need javascript for that.
jQuery(document).ready(function(){
var buttons = [{name:'button'},{name:'button'},{name:'button'},{name:'button'},{name:'button'},{name:'button'}];
var b;
for(b in buttons){
var rev = buttons.length - (b*10);
var btn = jQuery(''+ buttons[b].name + ' ' + b +'').css({left:rev/2, width:100 - rev} );
jQuery('.abduction').append(btn);
}
});
* { box-sizing: border-box; }
body { font: normal 16px sans-serif; }
.spaceship {
height: 430px;
position: relative;
width: 140px;
}
.spaceship::before {
background: #006dd9;
border-radius: 100%;
content: '';
height: 70px;
position: absolute;
width: 140px;
z-index: 1;
}
.abduction {
height: 370px;
left: 20px;
padding-top: 10px;
position: absolute;
top: 60px;
width: 100px;
}
.abduction a {
display:block;
position:relative;
color: #fff;
display: block;
height: 60px;
text-align: center;
text-decoration: none;
text-transform: uppercase;
transition: background 500ms;
border-bottom:80px solid #0f0;
border-left:5px solid transparent;
border-right:5px solid transparent;
}
.abduction a:nth-child(even) { border-bottom: 80px solid #00d900; }
.abduction a:hover { border-bottom: 80px solid #008c00; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="spaceship">
<div class="abduction">
</div>
</div>