I have some code snippets on my blog post here.
There I have custom scrollbar defined with this code below:
/* width */
::-webkit-scrollbar {
width: 20px;
}
/* Track */
::-webkit-scrollbar-track {
box-shadow: inset 0 0 5px grey;
border-radius: 10px;
}
/* Handle */
::-webkit-scrollbar-thumb {
background: #0ef;
border-radius: 10px;
}
The place where I have included the snippet is a custom div element with border radius of 2em. Now the custom scrollbar looks some bulged out as you can see in the image below:
How can I send the scrollbar behind the <div> so that the extra scrollbar may be removed?
P.S.: The border radius of the <div> should be maintained.
You can put a small div inside your outer div and make that the container of your scroll bar to stop the bulging out of these scroll bars eg. fiddle like
<div class="outer">
<div class="inner">
..content
</div>
</div>
.outer{
max-height:200px;
width:250px;
border-radius:10px;
padding:0px 0px;
background:#ccc;
}
.inner{
white-space: nowrap;
width:250px;
max-height:200px;
overflow-x:scroll;
overflow-y:hidden;
border-radius:8px;
}
/* width */
::-webkit-scrollbar {
width: 20px;
}
/* Track */
::-webkit-scrollbar-track {
box-shadow: inset 0 0 5px grey;
border-radius: 10px;
}
/* Handle */
::-webkit-scrollbar-thumb {
background: #0ef;
border-radius: 10px;
}
<div class="outer">
<div class="inner">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum
</div>
</div>
Related
I'm trying to write HTML/CSS in a way that I have a div which can be scrolled both vertically and horizontally, but ONLY the horizontal scrollbar is visible. So the vertical scrolling is done using mouse wheel and horizontal using the scrollbar at the bottom (and other, usual controles like keyboard etc.). The usually suggested solution with -webkit-scrollbar display none doesn't apply here because it can only hide both scrollbars, hence the new question.
So, basically, I need behaviour like this, except the horizontal scrollbar should still be there:
.content {
width:400px;
height:200px;
}
.container {
overflow-x: auto;
overflow-y: auto;
height: 100px;
width: 200px;
}
.container::-webkit-scrollbar {
display: none;
}
<div class="container">
<div class="content">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
</div>
You can use -webkit-scrollbar, but you need to use width and height instead of display: none
div {
width: 100px;
height: 100px;
font-size: 48px;
overflow: auto;
}
::-webkit-scrollbar {
height: 0px;
width: 8px;
border: 1px solid #fff;
}
::-webkit-scrollbar-track {
border-radius: 0;
background: #eeeeee;
}
::-webkit-scrollbar-thumb {
border-radius: 0;
background: #b0b0b0;
}
<div>
Lorem ipsum dolor sit amet.
</div>
Shift scroll to move horizontally
width will just affect the vertical scroll while height will just affect the horizontal scroll. If you set height: 0px it will hide the horizontal scroll bar, but keep the vertical one.
I've floating DIV on left side and right side ellipse div,
On mouse hover/out on left side div it is collapse/expand, in this case ellipses are not working.
I'm using two line ellipses
It is behaving differently based on content and window size
$(function() {
$(".left-content").mouseover(function() {
$(".left").width("30%");
}).mouseout(function() {
$(".left").width("50%");
});
})
div.left {
float: left;
border: solid 2px blue;
text-align: justify;
margin: 5px;
width: 50%;
overflow: hidden;
}
div.right {
float: left;
margin: 5px;
}
div.ellipses-twoline {
border: solid 2px blue;
width: 178px;
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
text-overflow: ellipsis;
box-sizing: border-box;
margin-bottom: 5px;
}
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.js"></script>
<div class="left">
<div class="left-content">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
</div>
</div>
<div class="right">
<div class="ellipses-twoline">Located in Palm Springs and Santa Barbara, California, H3K Design specializes in design consultation and project management for house and building</div>
<div class="ellipses-twoline">
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help
</div>
</div>
View on JSFiddle
I am trying to make a ticket system, and it's designed to be similar to a forum thread system, ie have the user info on the left side like avatar and username, and then have the post data on the right hand side, I have managed to make a design for this in html/css and it works perfectly but there is an issue
As you can see when the right hand column stretches (due to it being filled with content, the left hand column doesnt stretch with it)
I have tried setting the height of the left-hand column to 100% to effectively fill its container but it doesn't seem to work
HTML:
<div class="ticket_content">
<div class="tickets_left"><img src="images/avatar_admin.png"/>
<div class="usernameinfo">ADMINISTRATOR</div>
<div clas="clear"></div>
</div>
<div class="tickets_right_admin"><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum</p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum</p> </div>
<div class="clear"/></div>
</div>
CSS
.ticket_content {
width: 900px;
display: block;
border: 2px solid #171B1E;
border-radius: 6px;
background: none repeat scroll 0% 0% #121416;
margin-bottom: 22px;
box-shadow: 0px 0px 7px rgba(212, 198, 198, 0.79);
}
.tickets_right {
float: left;
width: 750px;
min-height: 185px;
background: none repeat scroll 0% 0% #121416;
}
.tickets_right_admin {
background: #353018;
float: left;
width: 750px;
min-height: 185px;
}
.tickets_right_admin p{
padding:18px;
}
.tickets_left {
float:left;
width: 141px;
background:red;
min-height: 185px;
background: url('../images/leftsiderepeat.png') repeat-y;
}
Again what i'm trying to achieve is have tickets_left fill ticket_content vertically when tickets_right stretches it (as you can see in the image the background of tickets_left does not follow the same height as the right hand side)
Fixed by using table cell display, for the inner-divs and table display for the outer div, also added
vertical-align:top
to the inner div's
Fixed css:
.tickets_left {
display: table-cell;
vertical-align: top;
width: 141px;
background:red;
min-height: 185px;
background: url('../images/leftsiderepeat.png') repeat-y;
}
.tickets_right {
display:table-cell;
float: left;
width: 750px;
min-height: 185px;
background: none repeat scroll 0% 0% #121416;
}
.tickets_right_admin {
display: table-cell;
background: #353018;
float: left;
width: 750px;
min-height: 185px;
}
.ticket_content {
display: table;
width: 900px;
border: 2px solid #171B1E;
border-radius: 6px;
background: none repeat scroll 0% 0% #121416;
margin-bottom: 22px;
box-shadow: 0px 0px 7px rgba(212, 198, 198, 0.79);
}
try the following style for inner div:
{
position: relative;
left: 0;
top: 0;
width100%;
height:100%;
}
<div class='col-md-4'>
<div class="thumbnail">
<img src="media1/thumb3.jpg">
<div class="caption">
<h3>Lorem Ipsum</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
t</span>ΔΌ</span>
</div>
</div>
</div>
Here is my CSS
.thumbnail img{
width: 300px;
height: 300px;
border-radius: 150px;
}
.thumbnail {
border:none;
}
.thumbnail:hover {
background-color: #F2F3F4;
}
I would like to add border only to an image when i hover a thumbnail and not to the entire thumbnail (caption etc). Is there any way to do that using css ?
Give an id to the image say id="image"
And in the jquery use
<script>
$(document).ready(function(){
$('.thumbnail').mouseover(function(){
$('#image').css("border","2px solid black");
});});
$(document).ready(function(){
$('.thumbnail').mouseout(function(){
$('#image').css("border","0px");
});});
</script>
Do not forget to include the jquery script required to run jquery:-
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
If you thumbnail div closes before img then you can do that. See this
On a CSS hover event, can I change another div's styling?
Just set this style:
.thumbnail:hover img {
border: solid 5px green;
margin: -5px;
}
The margin is to avoid the "changing position" effect
demo
If you want to change border on hover use :hover to the element in this case we will use this code
.thumbnail img:hover {
border: 3px solid #dddddd;
}
to control the changin position add a white border with same thickness to the normal state
.thumbnail img {
border: 3px solid #ffffff;
}
the complete code will be
.thumbnail img {
border: 3px solid #ffffff;
}
.thumbnail img:hover {
border: 3px solid #dddddd;
}
I have a div, with the style shown below, and I would like a nice border around it.
The border-radius works, but the border-style and border-width does not show. I can't see why this is happening.
<html>
<head>
<style>
div.request{
background-color: #CDCDCD;
margin-left:auto;
margin-right:auto;
display:block;
width:700px;
height:2000px;
text-align:center;
box-shadow: 10px 10px 15px #000000
border-style: outset;
border-width:5px;
border-color: #FFFFFF;
border-radius:25px;
padding:10px;
}
</style>
</head>
<body>
<div class='request'>
<p>
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
</p>
<p>
</p>
</div>
You missed a ; near box-shadow: 10px 10px 15px #000000. Every CSS-Rule -expect the last one- must have the closing semicolon. To prevent errors you should always add the ;.
http://jsfiddle.net/Rnx7m/
/** This is always working */
div.request{
margin: 25px;
padding:10px /* missing semicolon ignored by browsers */
}
/** This is an error */
div.request{
margin: 25px /* Breaking */
padding:10px;
}
the closing ; is missing at the end of the following line: box-shadow: 10px 10px 15px #000000