I am able to customize scrollbar which now looks like below
But, the scrollbar-button looks ugly. I am trying to make the buttons looking like below:
Can anyone please help?
I am using the below css for customizing the scrollbar.
::-webkit-scrollbar {
width: 16px;
}
::-webkit-scrollbar-track {
background: rgb(224, 224, 224);
}
::-webkit-scrollbar-thumb {
background: rgb(200, 200, 200);
border: 0.05em solid #eeeeee;
}
::-webkit-scrollbar-thumb:hover {
background: rgb(180, 180, 180);
}
::-webkit-scrollbar-thumb:active {
background: rgb(117, 117, 117);
}
::-webkit-scrollbar-button {
border-style: solid;
height: 16px;
width: 16px;
}
::-webkit-scrollbar-button:vertical:decrement {
border-width: 0 7px 14px 7px;
border-color: transparent transparent rgb(117, 117, 117) transparent;
}
::-webkit-scrollbar-button:vertical:decrement:hover {
border-color: transparent transparent rgb(180, 180, 180) transparent;
}
::-webkit-scrollbar-button:vertical:increment {
border-width: 14px 7px 0 7px;
border-color: rgb(117, 117, 117) transparent transparent transparent;
}
::-webkit-scrollbar-button:vertical:increment:hover {
border-color: rgb(180, 180, 180) transparent transparent transparent;
}
Please try below
.scrollbar
{
margin-left: 30px;
float: left;
height: 300px;
width: 50px;
background: #F5F5F5;
overflow-y: scroll;
margin-bottom: 25px;
}
.overflow
{
min-height: 400px;
}
#wrapper
{
text-align: center;
width: 500px;
margin: auto;
}
#stylescroll::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
background-color: #F5F5F5;
}
#stylescroll::-webkit-scrollbar
{
width: 6px;
background-color: #F5F5F5;
}
#stylescroll::-webkit-scrollbar-thumb
{
background-color: #a6aebb;
}
<div id="wrapper">
<div class="scrollbar" id="stylescroll">
<div class="overflow"></div>
</div>
</div>
Scrollbar with Custom buttons(both horizontal and vertical bar).....Have a look
Have to customize these classes like:
::-webkit-scrollbar-button:single-button:vertical:decrement {
border-radius: 5px 5px 0 0
height: 16px;
width: 16px;
background-position: center 4px;
background-image: url("data:image/svg+xml;utf8,<svg
xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='rgb(121, 255,
108)'><polygon points='50,00 0,50 100,50'/></svg>");
}
Related
I tried creating a button. I didn't set the width so it should automatically increase the width when I add a margin to the div or the svg, but it just scales it down and hides the overflow.
.btn {
position: relative;
display: flex;
background: none;
margin: 0.5% 0;
padding: .8%;
border: 1px solid rgba(255, 255, 255, 0);
border-radius: 5px;
cursor: pointer;
color: white;
gap: 20%;
&:hover {
background: rgba(255, 255, 255, .1);
border: 1px solid rgba(255, 255, 255, .4);
}
&:hover.disabled {
background: none;
border: 1px solid rgba(255, 255, 255, 0);
}
&.disabled {
cursor: default;
color: gray;
}
& svg {
background: none;
color: white;
cursor: pointer;
height: 100%;
}
& div {
font-size: 100%;
}
}
Tested the following code on Firefox, and it works as expected. I do not understand what is the problem you are facing, and on what browser.
Also, since, you did not provide any information about the div inside your button, I left it as an empty element. As a result, the div occupies zero width for its content - since it has no content inside of it. Although, padding and margin on the div should work.
Plus, I set box-sizing: border-box on everything using the wildcard selector, since it makes visualizing layout boxes a bit intuitive.
* {
box-sizing: border-box;
}
.btn {
position: relative;
display: flex;
background: transparent;
margin: 0.5% 0;
padding: 0.8%;
/* Changed the border color, so we can see the button size grow */
border: 1px solid black;
border-radius: 5px;
cursor: pointer;
color: white;
gap: 20%;
}
.btn:hover {
background: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.4);
}
.btn:hover.disabled {
background: none;
border: 1px solid rgba(255, 255, 255, 0);
}
.btn.disabled {
cursor: default;
color: gray;
}
.btn svg {
background: none;
color: white;
cursor: pointer;
height: 100%;
/* Adding margin to check if everything is working fine */
margin: 10px;
}
.btn div {
font-size: 100%;
}
<button class="btn">
<svg width="18" height="18" viewBox="0 0 18 18">
<path d="M15 2V1H3v1H0v4c0 1.6 1.4 3 3 3v1c.4 1.5 3 2.6 5 3v2H5s-1 1.5-1 2h10c0-.4-1-2-1-2h-3v-2c2-.4 4.6-1.5 5-3V9c1.6-.2 3-1.4 3-3V2h-3ZM3 7c-.5 0-1-.5-1-1V4h1v3Zm8.4 2.5L9 8 6.6 9.4l1-2.7L5 5h3l1-2.7L10 5h2.8l-2.3 1.8 1 2.7h-.1ZM16 6c0 .5-.5 1-1 1V4h1v2Z"
></path>
</svg>
<div></div>
</button>
at first I thought it was easy, until I tried...
is there some god of css can help me lol
but there is a premise, use css only and one html tag, no special character like ★
I finished the outside, But I got one tsudo content only, how to set two stars and one word into that or optimize that(not a real button, just look like it will be fine, thaaaaaaaaaaanks for any help or any thought)
i post what I did so far, and sorry for described it unclearly, It look like a button, not a lol.
#foo::after {
content: "";
position: absolute;
height: 31px;
width: 101px;
border: 1px solid rgb(90, 90, 90);
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
border-radius: 8px;
box-shadow: 1px 1px 1px lightgrey;
}
#foo::before {
content: "";
color: rgb(78, 78, 78);
font-weight: bold;
font-size: 10px;
position: absolute;
height: 24px;
width: 93px;
border: 1px solid rgb(161, 161, 161);
/* box-shadow: 1px 1px rgb(134, 134, 134); */
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
border-radius: 6px;
background: linear-gradient(rgb(230, 228, 228) 53%, rgb(199, 199, 199) 55%);
}
#foo {
position: relative;
height: 30px;
width: 100px;
border: 1px solid white;
border-radius: 8px;
background: rgb(209, 206, 206);
}
<div id="foo"></div>
Use before or after pseudo selector to add text. Use CSS Entities or HTML Symbols to add stars.
Use multiple box-shadows to add multiple border styles
body {
padding: 25px;
}
#foo:before {
content: "★ CHECKOUT ★";
}
#foo {
display: inline-block;
position: relative;
padding: 15px 20px;
border-radius: 8px;
font-weight:bold;
font-family:sans-serif;
background: linear-gradient(rgb(230, 228, 228) 53%, rgb(199, 199, 199) 55%);
box-shadow: 0 1px 2px 2px #0000001a, 0 0 0 8px #cbcbcb, 0 0 0 10px white, 0 0 0 12px #7d7d7d;
}
<div id="foo"></div>
Here is my idea where I build the start using background (https://dev.to/afif/background-pattern-star-shape-194m)
body {
padding: 25px;
}
#foo:before {
content: "CHECKOUT";
display:block;
padding:20px 50px;
--s: 40px; /* size */
--m: 113px; /* space */
--v1:transparent,#fff 0.5deg 108deg,transparent 109deg;
--v2:transparent,#888888 0.5deg 36deg,transparent 37deg;
background:
conic-gradient(from 54deg at calc(var(--s)*0.68) calc(var(--s)*0.57),var(--v1)),
conic-gradient(from 126deg at calc(var(--s)*0.5) calc(var(--s)*0.7) ,var(--v1)),
conic-gradient(from 162deg at calc(var(--s)*0.5) 0 ,var(--v2)),
conic-gradient(from 90deg at calc(var(--s)*0.02) calc(var(--s)*0.35),var(--v2));
background-size: calc(var(--s) + var(--m)) calc(var(--s) + var(--m));
mix-blend-mode: darken;
background-position: 0 9px;
}
#foo {
display: inline-block;
position:relative;
padding: 5px 10px;
border-radius: 8px;
font-weight: bold;
font-family: sans-serif;
background: linear-gradient(rgb(230, 228, 228) 53%, rgb(199, 199, 199) 55%);
box-shadow: 0 1px 2px 2px #0000001a, 0 0 0 8px #cbcbcb, 0 0 0 10px white, 0 0 0 12px #7d7d7d;
}
<div id="foo"></div>
I'm trying to create the following tooltip (not the contents within - just the box & arrow):
I'm having an issue getting the arrow to blend in correctly with the main box.
I created a Fiddle here with the code I have so far.
You will notice the arrow looks ok but just doesn't fit in 100%, I'm not sure how to finish it.
Below is the arrow code:
.arrow_box:after, .arrow_box:before {
border: 11px solid;
border-color: inherit;
border-left: 11px solid transparent;
border-right: 11px solid transparent;
position: absolute;
content: '';
left: 90%;
bottom: 100%;
}
.arrow_box:after {
border-color: rgba(136, 183, 213, 0);
border-bottom-color: #f3f3f3;
border-width: 13px;
margin-left: -23px;
}
.arrow_box:before {
border-color: rgba(194, 225, 245, 0);
border-bottom-color: #e1e1e1;
border-width: 15px;
margin-left: -25px;
}
http://jsfiddle.net/9uppsLqa/5/
.arrow_box {
border-radius: .1875em;
z-index: 99;
position: relative;
box-shadow: 0 0 0 1px rgba(0,0,0,0.15),inset 0 0 0 1px rgba(255,255,255,0.6), 0 4px 2px -2px rgba(0,0,0,0.2),0 0 1px 1px rgba(0,0,0,0.15);
background-repeat: repeat-x;
background-position: 0 0;
background-image: linear-gradient(to bottom,rgba(255,255,255,0.7) 0,rgba(255,255,255,0) 100%);
background-color: #e1e1e1;
margin-top: 3em;
margin-left: .75em;
margin-right: .75em;
padding-left: 0;
padding-bottom: 0;
padding-right: 0;
padding-top: 0;
width: 340px;
height: 160px;
}
.arrow_box:after, .arrow_box:before {
border: 13px solid transparent;
position: absolute;
content: '';
left: 90%;
bottom:100%;
}
.arrow_box:after {
border-bottom-color: #fafafa;
border-width: 14px;
margin-left: -24px;
}
.arrow_box:before {
border-bottom-color: #999;
border-width: 15px;
margin-left: -25px;
}
I am trying to apply some style-sheet for scrollbars of QScrollArea and my style sheet as follows.
QScrollBar:vertical {
border-color: rgb(227, 227, 227);
border-width: 1px;
border-style: solid;
background-color: rgb(240, 240, 240);
width: 15px;
margin: 21px 0 21px 0;
}
QScrollBar::handle:vertical {
background-color: rgb(200, 200, 200);
min-height: 25px;
}
QScrollBar::add-line:vertical {
border: 1px solid grey;
background-color: rgb(241, 241, 241);
height: 20px;
subcontrol-position: bottom;
subcontrol-origin: margin;
}
QScrollBar::sub-line:vertical {
border: 1px solid grey;
background-color: rgb(241, 241, 241);
height: 20px;
subcontrol-position: top;
subcontrol-origin: margin;
}
QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
background: none;
}
QScrollBar::up-arrow:vertical
{
image: url(:/BarIcon/Icons/uparrow.png);
}
QScrollBar::down-arrow:vertical
{
image: url(:/BarIcon/Icons/downarrow.png);
}
QScrollBar:horizontal {
border-color: rgb(227, 227, 227);
border-width: 1px;
border-style: solid;
background-color: rgb(240, 240, 240);
width: 15px;
margin: 0px 21px 0 21px;
}
QScrollBar::handle:horizontal {
background-color: rgb(200, 200, 200);
min-height: 25px;
}
QScrollBar::add-line:horizontal {
border: 1px solid grey;
background-color: rgb(241, 241, 241);
width: 20px;
subcontrol-position: right;
subcontrol-origin: margin;
}
QScrollBar::sub-line:horizontal {
border: 1px solid grey;
background-color: rgb(241, 241, 241);
width: 20px;
subcontrol-position: left;
subcontrol-origin: margin;
}
QScrollBar:left-arrow:horizontal
{
image: url(:/BarIcon/Icons/leftarrow.png);
}
QScrollBar::right-arrow:horizontal
{
image: url(:/BarIcon/Icons/rightarrow.png);
}
QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal {
background: none;
}
This stylesheet perfectly does what it was supposed to for vertical scrollbar but with presence of any single stylesheet related to QScrollBar:horizontal, the bar just disappears.
Please can anyone point out my flaw and what should I do?
Notes:
The styleSheet have been applied on QScrollArea object by using Change styleSheet option of Qt Designer.
And please kindly acknowledge in case where the horizontal scrollbar shows up with this styleSheet on.
You are lucky, the same thing just happened to me today.
This really simple, this is because you just copy-past your vertical style for the horizontal and just change the word "vertical" to "horizontal", but actually there is a few more things to change:
The "width" parameters become "height" in horizontal.
The "height" parameters become "width".
"top" and "bottom" become "left" and "right" (that you did).
Also, if you have asymmetrical margins or such, don't forget to adapt them (you did that too).
This gives the following stylesheet for your particular case:
QScrollBar:vertical {
border-color: rgb(227, 227, 227);
border-width: 1px;
border-style: solid;
background-color: rgb(240, 240, 240);
width: 15px;
margin: 21px 0 21px 0;
}
QScrollBar::handle:vertical {
background-color: rgb(200, 200, 200);
min-height: 25px;
}
QScrollBar::add-line:vertical {
border: 1px solid grey;
background-color: rgb(241, 241, 241);
height: 20px;
subcontrol-position: bottom;
subcontrol-origin: margin;
}
QScrollBar::sub-line:vertical {
border: 1px solid grey;
background-color: rgb(241, 241, 241);
height: 20px;
subcontrol-position: top;
subcontrol-origin: margin;
}
QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
background: none;
}
QScrollBar::up-arrow:vertical
{
image: url(:/BarIcon/Icons/uparrow.png);
}
QScrollBar::down-arrow:vertical
{
image: url(:/BarIcon/Icons/downarrow.png);
}
QScrollBar:horizontal {
border-color: rgb(227, 227, 227);
border-width: 1px;
border-style: solid;
background-color: rgb(240, 240, 240);
height: 15px;
margin: 0px 21px 0 21px;
}
QScrollBar::handle:horizontal {
background-color: rgb(200, 200, 200);
min-width: 25px;
}
QScrollBar::add-line:horizontal {
border: 1px solid grey;
background-color: rgb(241, 241, 241);
height: 20px;
subcontrol-position: right;
subcontrol-origin: margin;
}
QScrollBar::sub-line:horizontal {
border: 1px solid grey;
background-color: rgb(241, 241, 241);
height: 20px;
subcontrol-position: left;
subcontrol-origin: margin;
}
QScrollBar:left-arrow:horizontal
{
image: url(:/BarIcon/Icons/leftarrow.png);
}
QScrollBar::right-arrow:horizontal
{
image: url(:/BarIcon/Icons/rightarrow.png);
}
QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal {
background: none;
}
Here is drop down box I got to work for me.
But it goes outof boundry on left end. Actually menu items should fit exactly below the text box.
Check Fiddle
I tried changing width of all element but could not set it. Can some one tell me which class exactly controls width of menu item which appear when dropdown box is popped?
css:
.container {
width:90%;
margin:10% auto;
}
.dropdown-menu{
width:85%;
margin:0 auto;
}
.twitter-typeahead .tt-query, .twitter-typeahead .tt-hint {
margin-bottom: 0;
width: 360px; !important;
}
.twitter-typeahead .tt-hint {
display: block;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.428571429;
border: 1px solid transparent;
border-radius:4px;
}
.twitter-typeahead .hint-small {
height: 30px;
padding: 5px 10px;
font-size: 12px;
border-radius: 3px;
line-height: 1.5;
}
.twitter-typeahead .hint-large {
height: 45px;
padding: 10px 16px;
font-size: 18px;
border-radius: 6px;
line-height: 1.33;
}
.tt-dropdown-menu {
min-width: 260px;
margin-top: 2px;
padding: 5px 0;
background-color: #fff;
border: 1px solid #ccc;
border: 1px solid rgba(0, 0, 0, .2);
*border-right-width: 2px;
*border-bottom-width: 2px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
-moz-box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
-webkit-background-clip: padding-box;
-moz-background-clip: padding;
background-clip: padding-box;
}
.tt-suggestion {
display: block;
padding: 3px 20px;
}
.tt-suggestion.tt-is-under-cursor {
color: #fff;
background-color: #0081c2;
background-image: -moz-linear-gradient(top, #0088cc, #0077b3);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3));
background-image: -webkit-linear-gradient(top, #0088cc, #0077b3);
background-image: -o-linear-gradient(top, #0088cc, #0077b3);
background-image: linear-gradient(to bottom, #0088cc, #0077b3);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0)
}
.tt-suggestion.tt-is-under-cursor a {
color: #fff;
}
.tt-suggestion p {
margin: 0;
}
On your class .dropdown-menu add this:
.dropdown-menu{
width:360px;
left:auto;
margin:0 auto;
}
The Fiddle demo
It's because 360px is the size of your input .twitter-typeahead .tt-query, .twitter-typeahead .tt-hint.
And the left:auto to keep the original distance no matter the absolute position.