scrollbar inside fixed div - css

I have a fixed div and need the content to be able to be scrolled when its width exceeds the window size. I need this div with position: fixed because it's next to a column with display: none, and if I float it or position it in any other way it will take up the space of that hidden column. So the problem is I can't make the scroll work within this div. It's a pretty big CSS so I'll post what I think is relevant.
CSS
#main {
background-color: yellow;
height: 100%;
overflow: auto;
position: fixed;
top: 10px;
left: 380px;
}
#container {
background-color: red;
height: auto;
margin-left: 20px;
width: 700px/*655px*/;
overflow: auto;
}
#tabs {
background-color: blue;
float: left;
height: 100%;
margin-top: -187px;
margin-left: 20px;
width: 500px/*50%*/;
}
ul#slider {
height: 350px;
list-style: none;
margin: 0px;
padding: 0px;
width: 700px;
overflow: hidden;
position: relative;
}
ul#thumb {
background-color: #000;
list-style: none;
margin: 0 0 0 500px;
width: 200px;
position: relative;
overflow: auto;
/*overflow: hidden;*/
}
ul#thumb a {
border: 1px solid #bfbfbf;
display: block;
float: left;
height: 40px;
margin: 10px 0 10px 24px;
width: 40px;
opacity: 0.75;
overflow: hidden;
}
And the HTML:
<div id="main">
<div id="container">
<ul id="slider">
<li id="1"><img src="img/img01.jpg" alt="img01" width="700" height="350" /></li>
<li id="2"><img src="img/img02.jpg" alt="img02" width="700" height="350" /></li>
<li id="3"><img src="img/img03.jpg" alt="img03" width="700" height="350" /></li>
<li id="4"><img src="img/img04.jpg" alt="img04" width="700" height="350" /></li>
</ul>
<ul id="thumb">
<li><img src="img/img01.jpg" alt="img01" width="50" height="50" /></li>
<li><img src="img/img02.jpg" alt="img02" width="50" height="50" /></li>
<li><img src="img/img03.jpg" alt="img03" width="50" height="50" /></li>
<li><img src="img/img04.jpg" alt="img04" width="50" height="50" /></li>
</ul>
<img id="title" src="img/title.jpg" width="119" height="61" alt="" />
<div id="tabs">
<div class="verticalslider" id="text">
<ul class="verticalslider_tabs">
<li>Tab 01</li>
<li>Tab 02</li>
<li>Tab 03</li>
<li>Tab 04</li>
</ul>
<ul class="verticalslider_contents">
<li>
<table>
<tr><td>Description tab 01</td></tr>
</table>
</li>
<li>
<table>
<tr><td>Description tab 02</td></tr>
</table>
</li>
<li>
<table>
<tr><td>Description tab 03</td></tr>
</table>
</li>
<li>
<table>
<tr><td>Description tab 04</td></tr>
</table>
</li>
</ul>
</div>
</div>
</div>
The "container" div is the one that needs to be scrolled when resizing the browser window (I'm working with Opera and FF) but so far the content on the right just disappears and there's no way to see it. The vertical scrollbar doesn't show either but if I use the mouse wheel I can scroll down.
It's a big code and I've tried many combinations already but I'm starting to go in circles. It's probably an easy answer but It this point I can't figure it out so an outsider perspective will help.

I need this div with position: fixed
because it's next to a column with
display: none, and if I float it or
position it in any other way it will
take up the space of that hidden
column.
Hiding an element while preserving its size can be accomplished with a visibility: hidden style.

Related

Box shadow causing detrimental effect to image

To start off here is an image to illustrate what I'm dealing with:
I have seen a few other instances of people dealing with this where a border of sorts is applied to the bottom of an image. A solution was to set the images to display: block, but there was no explanation as to why this fixes it. I'm trying to understand why an image must have a display value of block when applying a box shadow property.
HTML
<div id="showcase">
<section>
<ul id="gallery">
<li><img src="img/img1.png" alt="One"></li>
<li><img src="img/img2.png" alt="Two"></li>
<li><img src="img/img3.png" alt="Three"></li>
<li><img src="img/img4.png" alt="Four"></li>
<li><img src="img/img5.png" alt="Five"></li>
<li><img src="img/img6.png" alt="Six"></li>
<li><img src="img/img7.png" alt="Seven"></li>
</ul>
</section>
<footer>
</footer>
</div>
CSS
#showcase {
max-width: 850px;
border: 2px dotted;
margin: 0 auto;
background: silver;
}
#gallery {
list-style: none;
padding: 0;
margin: 0;
}
#gallery li {
width: 45%;
float: left;
margin: 2.5%;
box-shadow: 0 8px 10px -5px;
}
Actually you're just missing to properly position your inline-block images using
#gallery img{
vertical-align: top; /* or any other value from */
}
https://developer.mozilla.org/en/docs/Web/CSS/vertical-align
Example with issue:
#gallery li{
display:inline-block;
box-shadow: 0 8px 10px -5px;
}
<ul id="gallery">
<li>
<img src="//placehold.it/60x60">
</li>
</ul>
Example with vertical-align on images
#gallery li{
display:inline-block;
box-shadow: 0 8px 10px -5px;
}
#gallery li img{
vertical-align: top;
}
<ul id="gallery">
<li>
<img src="//placehold.it/60x60">
</li>
</ul>
https://www.w3.org/TR/CSS2/visudet.html#propdef-vertical-align
Phrasing HTML elements like img are subject to typographical line-boxes unless set (overridden) to a block-level display state.

How to fix that Firefox renders Bootstrap Thumbnail differently than Google Chrome?

Why does the latest Firefox browser render Bootstrap thumbnails differently than Google Chrome? I stuck with getting all thumbnails equal height but can't figure out how.
Setting the max-width attribute to none fixes the height, but lets the image overflow its parent container. Can you tell me why and how to fix so that it appears in all Browsers like it appears in Google Chrome?
Here is my fiddle.
EDIT: added screenshots (right-click -> 'open in new tab' to see fullsize)
Chrome: max-width = 100% (default) - fitting nicely
Chrome: max-width = none - overflowing parent
Firefox: max-width = 100% (default) - downscaled by BS
Firefox: max-width = none - overflowing parent
If your images height is fixed to 240px, than one of the solutions is to wrap them in absolute positioned span and use this css:
.thumbnails {
margin: 0 0 10px 0;
padding: 0;
}
.thumbnail {
position: relative;
height: 250px;
}
.thumbnail span {
margin: 0 auto;
display: block;
position: absolute;
top: 4px;
left: 4px;
right: 4px;
bottom: 4px;
overflow: hidden;
}
.thumbnail span img {
margin: 0 auto;
display: block;
}
Check it in this Fiddle, or run the snippet below:
.thumbnails {
margin: 0 0 10px 0;
padding: 0;
}
.thumbnail {
position: relative;
height: 250px;
}
.thumbnail span {
margin: 0 auto;
display: block;
position: absolute;
top: 4px;
left: 4px;
right: 4px;
bottom: 4px;
overflow: hidden;
}
.thumbnail span img {
margin: 0 auto;
display: block;
}
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="panel panel-default">
<div class="panel-body">
<div id="slideshow">
<div>
<div>
<div data-index="1">
<ul class="thumbnails list-unstyled">
<li class="slide col-xs-4">
<a href="#" class="thumbnail" title="This is ok">
<span>
<img src="http://i.imgur.com/DONm5Ih.jpg" class="shot landscape" width="auto" height="auto" alt="image" />
</span>
</a>
</li>
<li class="slide col-xs-4">
<a href="#" class="thumbnail" title="This is ok">
<span>
<img src="http://i.imgur.com/TFEAQTJ.jpg" class="shot portrait" width="auto" height="auto" alt="image" />
</span>
</a>
</li>
<li class="slide col-xs-4">
<a href="#" class="thumbnail" title="This is ok">
<span>
<img src="http://i.imgur.com/WZbs0wI.jpg" class="shot landscape" width="auto" height="auto" alt="image" />
</span>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

divs move when hovering over other divs

I have a few work thumbnail divs in a container When I hover over one specific one, it shifts the ones after it along the next row. How can I resolve this?
HTML:
<div class="blog-container">
<h1>PRINT</h1>
<div class="work_thumbs">
<li class="print">
<div><img src="../Images/Tree Top News/Thumbs/TTN2.jpg" alt="Tree Top" border="0" class="thumb">TREE TOP NEWS</div>
</li>
<li class="print">
<div><img src="../Images/Harrow Council/Thumbs/Harrow Logo.jpg" alt="Harrow Council" border="0" class="thumb">HARROW COUNCIL</div>
</li>
<li class="print">
<div><img src="../Images/Regent/Thumbs/Regent logo.jpg" alt="Regent Care" border="0" class="thumb">REGENT CARE SERVICES</div>
</li>
<li class="print">
<div><img src="../Images/NLCS/Thumbs/NLCS logo.jpg" alt="NLCS" border="0" class="thumb">NLCS</div>
</li>
<li class="print">
<div><img src="../Images/Aish/Thumbs/AHC.jpg" alt="Aish" border="0" class="thumb"> AISH</div>
</li>
<li class="print">
<div><img src="../Images/FJL/Thumbs/FJL.jpg" alt="chicago graphic design" border="0" class="thumb">FJL</div>
</li>
<li class="print">
<div><img src="../Images/Tree Top News/Thumbs/TTN.png" alt="Canons high school" border="0" class="thumb">CANONS HIGH SCHOOL</div>
</li>
</div>
</div>
CSS:
.blog-container {
height: 100%;
width: 100%;
margin-top: 37px;
background-color:
}
.work_thumbs {
width:1000px;
margin: 0px auto 0 auto;
float: left;
}
.work_thumbs li {
margin: 0px 15px 15px 0px;
list-style-type: none;
display: block;
float: left;
display: inline;
font-family: "geogtq md";
color: #FFF;
overflow: hidden;
}
.work_thumbs li a {
float: inherit;
display: block;
width: 230px;
padding-bottom: 50px;
font-family: "geogtq md";
color: #00BDE5;
height: 200px;
border: 1px solid #02BDE5;
overflow: hidden;
}
.work_thumbs li .type {
color: #01BDE6;
}
.work_thumbs li a:hover {
background-color: #ceeef6;
border-bottom: 1px solid #a2a2a2;
text-decoration: none;
margin-bottom: -1px;
color: #007789;
font-family: "geogtq md";
}
.work_thumbs li .thumb {
margin-bottom: 15px;
display:block
}
element:hover{url('pathToImg.png'); position:relative; z-index:1;}
Make z-index:1 a higher index to suit your needs, and include a height and width as well.
You are changing the dimensions of your divs upon hover, by adding the negative margin-bottom. this causes your floating divs to 'hook' upon hover, in stead of starting at the left.
Here you can see it in action: http://jsfiddle.net/P8xEN/

How can I style a list item to contain images without any gaps between them?

I'm trying to style a set of images contained within an unordered list so that:
The <ul> occupies the full width of the containing element
Each <li> occupies 25% of the width of the <ul>
The images contained in the <li>scale proportionately as the screen is resized
The 8 total images arrange in two stacked rows of 4 images each
There are no gaps, either vertically or horizontally, between the images
I can accomplish the first four objectives in the list above, but can't seem to lose the gap between the first and second row of images.
Here's the markup:
<div class="container">
<ul>
<li><img src="http://davidangerer.com/i/sample.jpg" alt="Image Description" /></li>
<li><img src="http://davidangerer.com/i/sample.jpg" alt="Image Description" /></li>
<li><img src="http://davidangerer.com/i/sample.jpg" alt="Image Description" /></li>
<li><img src="http://davidangerer.com/i/sample.jpg" alt="Image Description" /></li>
<li><img src="http://davidangerer.com/i/sample.jpg" alt="Image Description" /></li>
<li><img src="http://davidangerer.com/i/sample.jpg" alt="Image Description" /></li>
<li><img src="http://davidangerer.com/i/sample.jpg" alt="Image Description" /></li>
<li><img src="http://davidangerer.com/i/sample.jpg" alt="Image Description" /></li>
</ul>
</div>
And the (post-reset) CSS:
.container {
width: 90%
max-width: 960px;
margin: 6em auto;
}
.container ul {
float: left;
display: block;
width: 25%;
height: auto;
}
.container img {
max-width: 100%;
height: auto;
width: auto\9; /* fixes a bug in ie8 */
}
Thanks in advance for any help you can provide.
Cheers,
David
You will have to set display:block; on the images and the lis to avoid that ugly inline margin between them. Check out this working jsFiddle
.container img {
display:block;
max-width: 100%;
height: auto;
width: auto\9; /* fixes a bug in ie8 */
}
.container ul li{ display:block; }
image are inline-boxes and stands on baseline (defaut value : vertical-align:baseline;). This explains the gap underneath. you can either fix it like:
.container img {
max-width: 100%;
height: auto;
width: auto\9; /* fixes a bug in ie8 */
vertical-align:top;
}
or
.container img {
max-width: 100%;
height: auto;
width: auto\9; /* fixes a bug in ie8 */
vertical-align:bottom;
}
or make your inline-boxe into a block-boxe
.container img {
max-width: 100%;
height: auto;
width: auto\9; /* fixes a bug in ie8 */
display:block;;
}

Float images into overflow without wrapper div

I got some images into a div.
<div>
<img />
<img />
<img />
<img />
</div>
All images are set to the same height of 50px. The width is set to auto.
The question is, how do i get the images to float left into a horizontal line that reached into the parent div's overflow area. The parent div need a width of 100%.
I want to set the div to overflow-x: scroll. When the images are simply float: left they break into another line if they extend the divs width. But how can I get them into the overflow, so i have to scroll to see the others?
The main problem is that i can't use js or a wrapper div. The problem has to be solved with css.
Use white-space: nowrap; on the container div and display:inline on the img elements.
FIDDLE
<div>
<img src="http://placehold.it/350x50"/>
<img src="http://placehold.it/350x50"/>
<img src="http://placehold.it/350x50"/>
<img src="http://placehold.it/350x50"/>
</div>
div
{
white-space:nowrap;
overflow-x: auto;
}
img
{
display: inline;
margin-right: 10px;
}
TRY this.. i hope this one can help you.,
Cascsading Syle..
.float_l { float: left }
.float_r { float: right }
.col_w200 {
overflow: scroll;
height: 300px;
width: 200px;
}
.lp_frontpage { margin: 0; padding: 0; list-style: none }
.lp_frontpage li {
margin: 0;
padding: 0;
display: inline
}
.lp_frontpage li a {
float: left;
display: table;
width: 200px;
height: 100px;
margin: 0 10px 10px 0
}
.lp_frontpage li a img { width: 190px; height: 90px; border: 1px solid #3c4445; padding: 4px; }
HTML CODE..
<div class="col_w200 float_r">
<h2>Web Design Gallery</h2>
<ul class="lp_frontpage">
<li><img width="200" height="100" src="images/_01.jpg" alt="Image 01" /></li>
<li><img width="200" height="100" src="images/_image_02.jpg" alt="Image 02" /></li>
<li><img width="200" height="100" src="images/_03.jpg" alt="image 03" /></li>
<li><img width="200" height="100" src="images/_04.jpg" alt="image 04" /></li>
</ul>
</div>

Resources