Im trying to figure out if it is possible to select the arrows when you cannot scroll any further in the designated direction. Has anyone come across a pseudo selector for this case ?
Here's an idea:
You can check if the user has scrolled down to the bottom via jquery.
I have inserted some css code about the scrollbar manipulation. Now you just have to combine them. Good luck!
Scrollbar customizations are not fully supported on Firefox and some other browsers
$(window).scroll(function() {
if($(window).scrollTop() + $(window).height() == $(document).height()) {
alert("bottom!");
}
});
.container {
display: block;
height: 800px;
}
::-webkit-scrollbar {
width: 16px;
border: 5px solid white;
}
::-webkit-scrollbar-thumb {
background-color: #b0b0b0;
background-clip: padding-box;
border: 0.05em solid #eeeeee;
}
::-webkit-scrollbar-track {
background-color: #bbbbbb;
}
/* Buttons */
::-webkit-scrollbar-button:single-button {
background-color: #bbbbbb;
display: block;
border-style: solid;
height: 13px;
width: 16px;
}
/* Up */
::-webkit-scrollbar-button:single-button:vertical:decrement {
border-width: 0 8px 8px 8px;
border-color: transparent transparent #555555 transparent;
}
::-webkit-scrollbar-button:single-button:vertical:decrement:hover {
border-color: transparent transparent #777777 transparent;
}
/* Down */
::-webkit-scrollbar-button:single-button:vertical:increment {
border-width: 8px 8px 0 8px;
border-color: #555555 transparent transparent transparent;
}
::-webkit-scrollbar-button:vertical:single-button:increment:hover {
border-color: #777777 transparent transparent transparent;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="container"></div>
I have a form:
<div class="ttSliderFrmCnt">
<form ref="form" class="ttSliderForm">
<input max="480" min="30" name="slider" type="range" value={this.props.totalSeconds}/>
</form>
</div>
I tried adding some custom styles, following this Css-tricks tutorial:
// Hide the default slider
input[type=range] {
-webkit-appearance: none; /* Hides the slider so that custom slider can be made */
width: 100%; /* Specific width is required for Firefox. */
background: transparent; /* Otherwise white in Chrome */
}
input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
}
input[type=range]:focus {
outline: none; /* Removes the blue border. You should probably do some kind of focus styling for accessibility reasons though. */
}
input[type=range]::-ms-track {
width: 100%;
cursor: pointer;
/* Hides the slider so custom styles can be added */
background: transparent;
border-color: transparent;
color: transparent;
}
// Style the thumb
/* Special styling for WebKit/Blink */
input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
border: 1px solid $darkDivider;
height: $bodyTextSize;
width: $bodyTextSize;
border-radius: 50%;
background: $accentColor;
margin-top: -5px; /* You need to specify a margin in Chrome, but in Firefox and IE it is automatic */
}
/* All the same stuff for Firefox */
input[type=range]::-moz-range-thumb {
border: 1px solid $darkDivider;
height: $titleTextSize;
width: $titleTextSize;
border-radius: 50%;
background: $accentColor;
}
/* All the same stuff for IE */
input[type=range]::-ms-thumb {
border: 1px solid $darkDivider;
height: $titleTextSize;
width: $titleTextSize;
border-radius: 50%;
background: $accentColor;
}
input[type=range]::-webkit-slider-runnable-track {
width: 100%;
height: 4px;
background: $accentColor;
border-radius: 2px;
border: 0.2px solid $darkDivider;
}
input[type=range]:focus::-webkit-slider-runnable-track {
background: $accentColor;
}
input[type=range]::-moz-range-track {
width: 100%;
height: 4px;
background: $accentColor;
border-radius: 2px;
border: 0.2px solid $darkDivider;
}
input[type=range]::-ms-track {
width: 100%;
height: 4px;
background: transparent;
border-color: transparent;
border-width: 2px 0;
color: transparent;
}
input[type=range]::-ms-fill-lower {
background: $accentColor;
border: 0.2px solid $darkDivider;
border-radius: 2px;
}
input[type=range]:focus::-ms-fill-lower {
background: $accentColor;
}
input[type=range]::-ms-fill-upper {
background: $accentColor;
border: 0.2px solid $darkDivider;
border-radius: 2px;
}
input[type=range]:focus::-ms-fill-upper {
background: $darkSecondaryText;
}
The variables used are either sizes in px, or color definitions and should not matter.
Now a curious thing happens, when I inspect this in chrome I get a margin I did not define on the input itself:
input[type="range" i] {
-webkit-appearance: slider-horizontal;
color: rgb(144, 144, 144);
padding: initial;
border: initial;
margin: 2px;
}
Where does this come from and how can I override it?
This is the user agent stylesheet of your browser. If you want to override the rule, simply define the rule in your CSS.
input[type="range"] {
margin: 0px;
}
<div class="ttSliderFrmCnt">
<form ref="form" class="ttSliderForm">
<input max="480" min="30" name="slider" type="range" value={this.props.totalSeconds}/>
</form>
</div>
I want to create a range input that has a track bar shaped like a triangle, much like many volume inputs appear. Here is an example.
I have read this useful guide to styling the input, but it does not have information on changing the shape of the track bar.
I do not want to use a custom range slider with JS that alters the real input, I want to use the actual range input itself. It should also be mostly cross browser.
How can I accomplish this?
You cannot reliably change the shape of the track bar itself in a cross browser manner, but you can hide the track bar and position an element or image behind it. Here is an example of this being done.
HTML
<input type="range" class="font-size-selector pd-select" id="font_size_selector" min="12" value="20" max="100" step="1">
<span class="triangle-range-background-slider"></span>
CSS
/* Trangle */
.triangle-range-background-slider {
position: relative;
display: block;
margin-top: -27px;
height: 20px;
background: url('https://i.ytimg.com/vi/tntOCGkgt98/maxresdefault.jpg');
background-size: 100% auto;
z-index: 1;
}
/* Input to work with triangle */
input[type=range] {
position: relative;
z-index: 3;
}
You could also use a CSS shape instead by removing the background image and placing this logic in there in it's place.
.triange-range-background-slider {
position: relative;
display: block;
margin-top: -27px;
border-top: 10px solid transparent;
border-right: 100px solid #3071a9;
border-bottom: 10px solid transparent;
z-index: 1;
}
Rest of the CSS is the Hide and Thumb from the CSS-Tricks link you provided.
https://css-tricks.com/styling-cross-browser-compatible-range-inputs-css/
Hide Input CSS
/* Hide */
input[type=range] {
-webkit-appearance: none; /* Hides the slider so that custom slider can be made */
width: 100%; /* Specific width is required for Firefox. */
background: transparent; /* Otherwise white in Chrome */
}
input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
}
input[type=range]:focus {
outline: none; /* Removes the blue border. You should probably do some kind of focus styling for accessibility reasons though. */
}
input[type=range]::-ms-track {
width: 100%;
cursor: pointer;
/* Hides the slider so custom styles can be added */
background: transparent;
border-color: transparent;
color: transparent;
}
Thumb Input CSS
/* Thumb */
/* Special styling for WebKit/Blink */
input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
border: 1px solid #000000;
height: 36px;
width: 16px;
border-radius: 3px;
background: #ffffff;
cursor: pointer;
// margin-top: -14px; /* You need to specify a margin in Chrome, but in Firefox and IE it is automatic */
box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d; /* Add cool effects to your sliders! */
}
/* All the same stuff for Firefox */
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;
}
/* All the same stuff for IE */
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;
}
I want to set the css of scrollbar buttons once the scrollbar thumb has reached the end in that direction. That is, I want to select the :decrement button when the scroll thumb cannot be decremented any more. The default scroll bar grays out buttons when they're in contact with the thumb. I thought the :disabled selector would do what I want, but no such luck.
::-webkit-scrollbar-track {
background-color: #bbbbbb;
}
/* Buttons */
::-webkit-scrollbar-button:single-button {
background-color: #bbbbbb;
display: block;
border-style: solid;
height: 13px;
width: 16px;
}
/* Up */
::-webkit-scrollbar-button:single-button:vertical:decrement {
border-width: 0 8px 8px 8px;
border-color: transparent transparent #555555 transparent;
}
::-webkit-scrollbar-button:single-button:vertical:decrement:hover {
border-color: transparent transparent #777777 transparent;
}
/* Down */
::-webkit-scrollbar-button:single-button:vertical:increment {
border-width: 8px 8px 0 8px;
border-color: #555555 transparent transparent transparent;
}
::-webkit-scrollbar-button:vertical:single-button:increment:hover {
border-color: #777777 transparent transparent transparent;
}
I am currently adding a navigation bar to a web page. But I am running into some css styling issues. The navigation menu bar is pushing the content below, leaving a huge gap in between and making it uneven. I took the precaution in leaving out anything that will mess with the bottom like margin bottom-padding but I am still getting the same result. How can I get the menu bar to not affect the content below? EXAMPLE
With the Navigation bar added:
Without navigation bar the contents below are even:
I have added the specific css rules that are causing the issue to devgrow.css:
<style>
#navigation {
position:relative;
top:-45px;
left:450px;
}
#au_title {
color: #FC821D;
font-size: 120%;
font-weight: bold;
left: 515px;
letter-spacing: 2px;
position: relative;
text-transform: uppercase;
top: -105px;
}
#searchInput {
left: 700px;
position: relative;
top: -180px;
}
#contentNav { color: #cfdae3; }
/* Dark Button CSS */
.buttonNav {
outline: 0;
padding: 5px 12px;
display: block;
color: #EBEBEB;
font-weight: bold;
text-shadow: 1px 1px #1f272b;
border: 1px solid #1c252b;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
background: #232B30; /* old browsers */
background: -moz-linear-gradient(top, #3D4850 3%, #313d45 4%, #232B30 100%); /* firefox */
background: -webkit-gradient(linear, left top, left bottom, color-stop(3%,#3D4850), color-stop(4%,#313d45), color-stop(100%,#232B30)); /* webkit */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3D4850', endColorstr='#232B30',GradientType=0 ); /* ie */
box-shadow: 1px 1px 1px rgba(0,0,0,0.2); /* CSS3 */
-moz-box-shadow: 1px 1px 1px rgba(0,0,0,0.2); /* Firefox */
-webkit-box-shadow: 1px 1px 1px rgba(0,0,0,0.2); /* Safari, Chrome */
}
.buttonNav:hover {
color: #fff;
background: #4C5A64; /* old browsers */
background: -moz-linear-gradient(top, #4C5A64 3%, #404F5A 4%, #2E3940 100%); /* firefox */
background: -webkit-gradient(linear, left top, left bottom, color-stop(3%,#4C5A64), color-stop(4%,#404F5A), color-stop(100%,#2E3940)); /* webkit */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#4C5A64', endColorstr='#2E3940',GradientType=0 ); /* ie */
}
.buttonNav:active {
background-position: 0 top;
position: relative;
top: 1px;
color: #fff;
padding: 6px 12px 4px;
background: #20282D; /* old browsers */
background: -moz-linear-gradient(top, #20282D 3%, #252E34 51%, #222A30 100%); /* firefox */
background: -webkit-gradient(linear, left top, left bottom, color-stop(3%,#20282D), color-stop(51%,#252E34), color-stop(100%,#222A30)); /* webkit */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#20282D', endColorstr='#222A30',GradientType=0 ); /* ie */
-moz-box-shadow: 1px 1px 1px rgba(255,255,255,0.1); /* Firefox */
-webkit-box-shadow: 1px 1px 1px rgba(255,255,255,0.1); /* Safari, Chrome */
box-shadow: 1px 1px 1px rgba(255,255,255,0.1); /* CSS3 */
}
/* Other stuff: */
.button-list { list-style: none; width: 100%; float: left; display: block; }
.button-list li { float: left; margin: 0 5px 0 0; }
.button-list li.search { padding-left: 18px; margin-left: 10px; position: relative; }
/* Search CSS: */
.search-input {
padding: 0 5px 0 22px;
border: 2px solid #DADADA;
height: 30px;
font-size: 12px;
line-height: 30px;
border-radius: 25px;
-moz-border-radius: 25px;
-webkit-border-radius: 25px;
background: #FFF; /* old browsers */
}
.search-input:focus {outline: none;}
.search-submit {
width: 13px;
height: 13px;
border: none;
background: url(images/mag-glass.png) no-repeat;
display: block;
position: absolute;
left: 26px;
top: 10px;
text-indent: -9999em;
}
</style>
First i have say that the coding is really bad. For fixed that issue remove float from you button-list. Write like this :
.button-list {
list-style: none outside none;
overflow: hidden;
}
Hey now define overflow hidden in your css #contentArea id
as like this
#contentArea {
overflow: hidden;
}
Add style clear both in css of first content area
<div id="contentArea" style="clear:both">