I have a button and styles for it, let's say this color is #e67410 for main-btn::before(border-top: 14px solid #e67410;), but in the safari browser this color turns black.
Could it be because of the dark theme on the iPhone? It has something to do with the css safari rules? Thanks.
this is a normal state
it's on a iphone
more code
.main-btn {
position: relative;
display: inline-block;
outline: 1px solid #0a5078;
background: #0a5078;
border: 7px solid #0a5078;
padding: 0.2rem 1.4rem;
overflow: hidden;
cursor: pointer;
text-align: center;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
#media screen and (max-width: 600px) {
padding: 0.4rem 1rem;
&:hover {
outline: 1px solid #e67410;
border: 7px solid #e67410;
background: #e67410;
&::before {
border-top: none !important;
border-right: none !important;
}
}
}
&.white {
outline: 1px solid #004f7a;
background: #fff;
border: 7px solid #fff;
span {
color: #004f7a;
}
#media screen and (max-width: 600px) {
&:hover {
outline: 1px solid #e67410;
border: 7px solid #e67410;
background: #e67410;
}
}
}
span {
position: relative;
color: #fff;
font-weight: normal;
font-size: 14px;
text-transform: uppercase;
z-index: 1;
}
&:hover {
&::before {
border-top: 400px solid #e67410;
border-right: 2000px solid transparent;
}
}
&::before {
position: absolute;
content: "";
width: 0;
height: 0;
border-top: 14px solid #e67410;
border-right: 14px solid transparent;
left: 0;
top: 0;
transition: 0.3s;
}
}
Related
I am trying to get this output:
But I am getting this due to my lack of CSS knowledge:
Here is my CSS Code:
input[type=range] {
height: 39px;
-webkit-appearance: none;
margin: 10px 0;
width: 100%;
}
input[type=range]:focus {
outline: none;
}
input[type=range]::-webkit-slider-runnable-track {
width: 100%;
height: 1px;
cursor: pointer;
animate: 0.2s;
background: transparent;
border-radius: 0px;
border-bottom: 5px dotted #000000;
}
input[type=range]::-webkit-slider-thumb {
box-shadow: 1px 1px 1px #ddd;
height: 25px;
width: 50px;
border-radius: 50px;
background: #FFFFFF;
cursor: pointer;
-webkit-appearance: none;
margin-top: -11.5px;
}
input[type=range]:focus::-webkit-slider-runnable-track {
background: transparent;
}
input[type=range]::-moz-range-track {
width: 100%;
height: 10px;
cursor: pointer;
animate: 0.2s;
box-shadow: 1px 1px 1px #000000;
background: #3071A9;
border-radius: 5px;
border: 1px solid #000000;
}
input[type=range]::-moz-range-thumb {
box-shadow: 1px 1px 1px #91FF69;
border: 2px solid #FF6991;
height: 30px;
width: 15px;
border-radius: 5px;
background: #FFFFFF;
cursor: pointer;
}
input[type=range]::-ms-track {
width: 100%;
height: 10px;
cursor: pointer;
animate: 0.2s;
background: transparent;
border-color: transparent;
color: transparent;
}
input[type=range]::-ms-fill-lower {
background: #3071A9;
border: 1px solid #000000;
border-radius: 10px;
box-shadow: 1px 1px 1px #000000;
}
input[type=range]::-ms-fill-upper {
background: #3071A9;
border: 1px solid #000000;
border-radius: 10px;
box-shadow: 1px 1px 1px #000000;
}
input[type=range]::-ms-thumb {
margin-top: 1px;
box-shadow: 1px 1px 1px #91FF69;
border: 2px solid #FF6991;
height: 30px;
width: 15px;
border-radius: 5px;
background: #FFFFFF;
cursor: pointer;
}
input[type=range]:focus::-ms-fill-lower {
background: #3071A9;
}
input[type=range]:focus::-ms-fill-upper {
background: #3071A9;
}
Would you please help me to get this?
Try changing max value eg:
<input type="range" id="volume" name="volume"
min="0" max="1100">
This will make it work smoothly
I was writing some CSS for a very common user login form, except that when I logged in from another computer with the same browser (Firefox) and operating system (Ubuntu), some strange white borders emerged on the outside.
What's even stranger is that they tend to appear and disappear simply by resizing the window.
Because? how can this be prevented?
Thanks everyone for the help! :)
HTML:
<div class="npt nptFocus">
<span>Aa</span>
<input type="text" name="usr" placeholder="Nickname">
</div>
LESS:
// Palette
#main_color: blue;
#main: darken(saturate(#main_color, -97%), 25%);
#neutral: saturate(darken(#main_color, -25%), -25%);
#verde: #118769;
#rosso: #fe5f55;
#bianco: darken(saturate(#main_color, -40%), -45%);
#v_soft = 10%;
#v_medium = 25%;
#v_hard = 40%;
#neutral_dark: darken(#neutral, #v_soft);
#verde_dark: darken(#verde, #v_soft);
#rosso_dark: darken(#rosso, #v_hard);
#main_light: lighten(#main, #v_hard);
#main_dark: darken(#main, 8%);
#radius: 5px;
.npt {
display: table;
background: #bianco;
border-radius: #radius;
border: solid 1px #main_light;
width: 100%;
overflow: hidden;
input, span{
display: table-cell;
padding: 10px;
transition: 0.25s;
}
input {
border: none;
background: none;
border-radius: 0px;
color: #main;
width: 100%;
}
span {
border-right: solid 1px darken(#main_light, -15%);
color: darken(#main, -40%);
background: darken(#main_light, -25%);
padding-left: 15px;
padding-right: 15px;
width: 55px;
}
&.nptFocus {
border: solid 1px #neutral_dark;
span {
border-right: solid 1px #neutral_dark;
color: #bianco;
background: #neutral_dark;
}
}
}
SCREEN:
UPDATE 1: Added compiled CSS
.npt {
display: table;
background: #ebebfa;
border-radius: 5px;
border: solid 1px #a3a3a8;
width: 100%;
overflow: hidden;
}
.npt input,
.npt span {
display: table-cell;
padding: 10px;
transition: 0.25s;
}
.npt input {
border: none;
background: none;
border-radius: 0px;
color: #3e3e42;
width: 100%;
}
.npt span {
border-right: solid 1px #cacace;
color: #a3a3a8;
background: #e5e5e6;
padding-left: 15px;
padding-right: 15px;
width: 55px;
}
.npt.nptFocus {
border: solid 1px #6363e9;
}
.npt.nptFocus span {
border-right: solid 1px #6363e9;
color: #ebebfa;
background: #6363e9;
}
.npt.nptError {
border: solid 1px #fe5f55;
}
.npt.nptError span {
border-right: solid 1px #fe5f55;
color: #ebebfa;
background: #fe5f55;
}
.npt.nptError.nptFocus {
border: solid 1px #d38580;
}
.npt.nptError.nptFocus span {
border-right: solid 1px #d38580;
background: #d38580;
}
.npt.nptOk {
border: solid 1px #118769;
}
.npt.nptOk span {
border-right: solid 1px #118769;
color: #ebebfa;
background: #118769;
}
.npt.nptOk.nptFocus {
border: solid 1px #6cac9b;
}
.npt.nptOk.nptFocus span {
border-right: solid 1px #6cac9b;
background: #6cac9b;
}
UPDATE 2:
Following the help of #Manas Khandelwal and the tests carried out together, it seems that this is due to a browser rendering error as the logo above the form, having the width declared as a percentage, will never have a height with an integer value .
Ideas?
Really the only solution is really having to round all the heights via JavaScript?
$('.roundHeight').each(function(){
if(!$(this).is("[data-exmargin]")) $(this).attr('data-exmargin',parseFloat($(this).css('marginTop')));
var d = parseFloat($(this).attr('data-exmargin')) - ($(this).height() - Math.floor($(this).height()));
$(this).css('marginTop', d + 'px');
});
Add outline: none; to the input element;
Codepen: https://codepen.io/manaskhandelwal1/pen/WNGgQwP
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 style an input of type "range" so that it looks the same in multiple browsers.
I've found some neat resources that I have used ...
https://css-tricks.com/styling-cross-browser-compatible-range-inputs-css/
http://danielstern.ca/range.css/#/
http://www.cssportal.com/style-input-range/
... but there is one issue that does not seem to be addressed. That is that Firefox and other browsers consider the height of the input to be the height of the of the track and the thumb combined (or something similar), however, Chrome seems to only consider the height of the track to be the height of the entire input.
This is my code (condensed):
.container {
border: 1px solid red;
background-color: lightgreen;
margin-top: 10px;
}
p {
border: 1px solid blue;
margin: 0;
padding: 0;
}
input[type=text],
input[type=range] {
-webkit-appearance: none;
width: 200px;
margin: 0;
padding: 0;
display: block;
height: 50px;
}
input[type=range]:focus {
outline: none;
}
input[type=range]::-webkit-slider-runnable-track {
width: 100%;
height: 4px;
cursor: pointer;
animate: 0.2s;
background: #ccc;
border: 1px solid #333;
}
input[type=range]::-webkit-slider-thumb {
border: 1px solid #333;
height: 30px;
width: 8px;
background: #fff;
-webkit-appearance: none;
margin-top: -7px;
}
input[type=range]:focus::-webkit-slider-runnable-track {
background: #367ebd;
}
input[type=range]::-moz-range-track {
width: 100%;
height: 4px;
cursor: pointer;
animate: 0.2s;
background: #ccc;
border: 1px solid #333;
}
input[type=range]::-moz-range-thumb {
border: 1px solid #333;
height: 30px;
width: 6px;
background: #fff;
}
<div class="container">
<p>
Some text...
</p>
<input type="range" />
<p>
Some more text...
</p>
</div>
<div class="container">
<input type="text">
</div>
If you run this in Chrome and Firefox you will see that the two browsers treat this differently. In Chrome the input gets a white background.
If I remove the height: 50px; on the input[type=range], there is also an obvious difference between the way the browsers treat the height.
As you can see, this affects how the tags above and after the range input are positioned relatively.
How do I work around this?
Reference from css-tricks.com
Support Firefox 23+, Chrome 6+, IE 10+ as per testing
You have missed some CSS I have mention in comment
.container {
border: 1px solid red;
background-color: lightgreen;
margin-top: 10px;
}
p {
border: 1px solid blue;
margin: 0;
padding: 0;
}
input[type=text] {
height: 50px;
}
input[type=text],
input[type=range] {
-webkit-appearance: none;
margin: 18px 0;
width: 200px;
}
input[type=range]:focus {
outline: none;
}
input[type=range]::-webkit-slider-runnable-track {
width: 100%;
height: 8.4px;
cursor: pointer;
animate: 0.2s;
box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
background: #3071a9;
border-radius: 1.3px;
border: 0.2px solid #010101;
}
input[type=range]::-webkit-slider-thumb {
box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
border: 1px solid #000000;
height: 36px;
width: 16px;
border-radius: 3px;
background: #ffffff;
cursor: pointer;
-webkit-appearance: none;
margin-top: -14px;
}
input[type=range]:focus::-webkit-slider-runnable-track {
background: #367ebd;
}
input[type=range]::-moz-range-track {
width: 100%;
height: 8.4px;
cursor: pointer;
animate: 0.2s;
box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
background: #3071a9;
border-radius: 1.3px;
border: 0.2px solid #010101;
}
input[type=range]::-moz-range-thumb {
box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
border: 1px solid #000000;
height: 36px;
width: 16px;
border-radius: 3px;
background: #ffffff;
cursor: pointer;
}
/* CSS is missing in your code */
input[type=range]::-ms-track {
width: 100%;
height: 8.4px;
cursor: pointer;
animate: 0.2s;
background: transparent;
border-color: transparent;
border-width: 16px 0;
color: transparent;
}
input[type=range]::-ms-fill-lower {
background: #2a6495;
border: 0.2px solid #010101;
border-radius: 2.6px;
box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
}
input[type=range]::-ms-fill-upper {
background: #3071a9;
border: 0.2px solid #010101;
border-radius: 2.6px;
box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
}
input[type=range]::-ms-thumb {
box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
border: 1px solid #000000;
height: 36px;
width: 16px;
border-radius: 3px;
background: #ffffff;
cursor: pointer;
}
input[type=range]:focus::-ms-fill-lower {
background: #3071a9;
}
input[type=range]:focus::-ms-fill-upper {
background: #367ebd;
}
<div class="container">
<p>
Some text...
</p>
<input type="range" />
<p>
Some more text...
</p>
</div>
<div class="container">
<input type="text">
</div>
I'm working on a CSS layout for my page, I'm just having a problem. On first page view the navbar loads all out of whack, but after page refresh, everything looks fine, here's an example:
Before:
After:
I'm not sure why it would be doing this I'm kind of new to CSS, any information would be great thanks!
Here's the CSS:
html, body {
margin: 0px;
}
.navbar-fixed {
background: -webkit-linear-gradient(top, #fff 0, #eee 85%, #ddd 100%);
border-top: 1px solid black;
border-bottom: 1px solid black;
border-radius: 3px;
box-shadow: 1px 1px 4px #e5e5e5;
position: fixed;
right: 0;
left: 0;
top: 0;
width: 100%;
}
.navbar-fixed ul {
display: inline-block;
margin: 0;
padding: 0;
}
.navbar-fixed ul li {
display: inline-block;
}
.navbar-fixed .logo a {
line-height: 50px;
padding: 0;
font-size: 32px;
letter-spacing: -3px;
transition: 0.3s;
font-weight: bold;
color: orange;
text-decoration: none;
text-shadow: 2px 2px 3px black;
margin: 0 2em 0 1em;
}
.navbar-fixed .logo a:hover {
text-shadow: 1px 1px 7px black;
color: white;
background: transparent;
}
.navbar-fixed ul.nav {
float: right;
}
.navbar-fixed ul.nav li a {
padding: 1em;
display: block;
color: #00AAEE;
cursor: pointer;
border: solid 0 1px 0 1px transparent;
transition: 0.5s;
text-decoration: none;
}
.navbar-fixed ul li a:hover, ul li.active a {
background-color: darkgrey;
border-color: #ccc;
color: white;
}
.container {
margin: 0 auto;
width: 70%;
}
.newswindow {
padding: 1em;
color: #fff;
background-color: rgba(0, 0, 0, 0.75);
position: absolute;
bottom: 0;
left: 0;
}
.newswindow h2 {
font-size: 42px;
border-bottom: 1px solid white;
letter-spacing: -2px;
}
.newswindow p {
font-size: 18px;
}
Some browser specific default styles could be interfering your defined styles. (Inherited styles, default more specifically defined styles for certain elements...)
For homogenous behavior in all browsers, use a CSS reset and define all the needed styles properly, not depending on browsers' defaults.
Here is a good source:
http://meyerweb.com/eric/tools/css/reset/