Hi I want to make vertical scrolling invisible, but i want to left the horizontal scrollbar visible.
Also I want my page be scrollable both vertically and horizontally.
I used:
.my_class::-webkit-scrollbar{
display: none;
}
but it make both scrollbar invisible.
overflow-y: hidden; // hide vertical
overflow-x: hidden; // hide horizontal
These two CSS properties can be used to hide the scrollbars.
I have to say that using simple css trick, you wont be able to achieve this.
I suggest you d use custom scrollbar plugins, by which you can simply apply css trick for each scrollbar type, like following:
$(document).ready(function() {
$(".container").customScrollbar();
});
.container {
max-width: 300px;
max-height: 100px;
}
.container .overview {
width: 800px;
}
.scrollable .scroll-bar.horizontal {
background: #eee; height: 5px; border-radius: 20px;
}
.scrollable .scroll-bar.horizontal .thumb {
background: #999;
border-radius: 20px;
cursor: pointer;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://rawgit.com/mzubala/jquery-custom-scrollbar/master/jquery.custom-scrollbar.css" />
<script src="https://rawgit.com/mzubala/jquery-custom-scrollbar/master/jquery.custom-scrollbar.js"></script>
<div class="container">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Proin nibh augue, suscipit a, scelerisque sed, lacinia in, mi. Cras vel lorem. Etiam pellentesque aliquet tellus. Phasellus pharetra nulla ac diam. Quisque semper justo at risus. Donec venenatis, turpis vel hendrerit interdum, dui ligula ultricies purus, sed posuere libero dui id orci. Nam congue, pede vitae dapibus aliquet, elit magna vulputate arcu, vel tempus metus leo non est. Etiam sit amet lectus quis est congue mollis. Phasellus congue lacus eget neque. Phasellus ornare, ante vitae consectetuer consequat, purus sapien ultricies dolor, et mollis pede metus eget nisi. Praesent sodales velit quis augue. Cras suscipit, urna at aliquam rhoncus, urna quam viverra nisi, in interdum massa nibh nec erat. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Proin nibh augue, suscipit a, scelerisque sed, lacinia in, mi. Cras vel lorem. Etiam pellentesque aliquet tellus. Phasellus pharetra nulla ac diam. Quisque semper justo at risus. Donec venenatis, turpis vel hendrerit interdum, dui ligula ultricies purus, sed posuere libero dui id orci. Nam congue, pede vitae dapibus aliquet, elit magna vulputate arcu, vel tempus metus leo non est. Etiam sit amet lectus quis est congue mollis. Phasellus congue lacus eget neque. Phasellus ornare, ante vitae consectetuer consequat, purus sapien ultricies dolor, et mollis pede metus eget nisi. Praesent sodales velit quis augue. Cras suscipit, urna at aliquam rhoncus, urna quam viverra nisi, in interdum massa nibh nec erat.
</div>
Use over flow property :
overflow-y: hidden
Related
This question already has answers here:
Fill remaining vertical space with CSS using display:flex
(6 answers)
Why don't flex items shrink past content size?
(5 answers)
Closed 2 years ago.
I've created a layout for a panel system I am working on (see code below). This is working fine, except that I need to use calc() in order to determine the height of the element minus their siblings. Since in the final stage the height of the sibling elements is dynamic it will not scale.
My question is, how could I make the following code example work without calc() where the values used inside of it will be dynamically determined?
body {
display: flex;
margin: 0;
}
.frame {
position: relative;
width: 250px;
height: 500px;
margin: 100px auto;
border: 2px solid black;
}
.panel {
position: absolute;
top: -64px;
bottom: 0;
width: 100%;
background-color: hotpink;
}
.panel-header {
width: 100%;
height: 64px;
background-color: lime;
flex-shrink: 0;
}
.panel-content {
width: 100%;
height: calc(100% - 64px);
background-color: aquamarine;
}
.panel-handle {
width: 100%;
height: 32px;
background-color: purple;
}
.panel-content-inner {
width: 100%;
height: calc(100% - 32px);
overflow-y: scroll;
}
<div class="frame">
<div class="panel">
<div class="panel-header"></div>
<div class="panel-content">
<div class="panel-handle"></div>
<div class="panel-content-inner">
<h4>Lorem impsum</h4>
<p>
orem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum iaculis rutrum pharetra.
Fusce id massa quis felis rutrum scelerisque eget a odio. Sed imperdiet, turpis vel mollis
pretium, lorem ipsum venenatis metus, nec consectetur quam quam blandit nibh. Suspendisse
ullamcorper cursus risus, sed venenatis libero aliquet ut. Aenean auctor porttitor odio eget
sollicitudin. Vestibulum nunc turpis, porta ac libero et, egestas dapibus tortor.
Pellentesque neque augue, mattis eu orci a, tempus ornare erat. Maecenas et ultricies
tellus, eu hendrerit est. Duis feugiat libero sit amet accumsan pharetra. Nulla volutpat sem
nec sapien interdum lobortis. Praesent a tortor leo. Fusce hendrerit fringilla consequat.
Nulla at justo nec risus placerat luctus. Aliquam vulputate ante justo, at auctor elit
porttitor et.
</p>
<h4>Lorem impsum</h4>
<p>
orem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum iaculis rutrum pharetra.
Fusce id massa quis felis rutrum scelerisque eget a odio. Sed imperdiet, turpis vel mollis
pretium, lorem ipsum venenatis metus, nec consectetur quam quam blandit nibh. Suspendisse
ullamcorper cursus risus, sed venenatis libero aliquet ut. Aenean auctor porttitor odio eget
sollicitudin. Vestibulum nunc turpis, porta ac libero et, egestas dapibus tortor.
Pellentesque neque augue, mattis eu orci a, tempus ornare erat. Maecenas et ultricies
tellus, eu hendrerit est. Duis feugiat libero sit amet accumsan pharetra. Nulla volutpat sem
nec sapien interdum lobortis. Praesent a tortor leo. Fusce hendrerit fringilla consequat.
Nulla at justo nec risus placerat luctus. Aliquam vulputate ante justo, at auctor elit
porttitor et.
</p>
<h4>Lorem impsum</h4>
<p>
orem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum iaculis rutrum pharetra.
Fusce id massa quis felis rutrum scelerisque eget a odio. Sed imperdiet, turpis vel mollis
pretium, lorem ipsum venenatis metus, nec consectetur quam quam blandit nibh. Suspendisse
ullamcorper cursus risus, sed venenatis libero aliquet ut. Aenean auctor porttitor odio eget
sollicitudin. Vestibulum nunc turpis, porta ac libero et, egestas dapibus tortor.
Pellentesque neque augue, mattis eu orci a, tempus ornare erat. Maecenas et ultricies
tellus, eu hendrerit est. Duis feugiat libero sit amet accumsan pharetra. Nulla volutpat sem
nec sapien interdum lobortis. Praesent a tortor leo. Fusce hendrerit fringilla consequat.
Nulla at justo nec risus placerat luctus. Aliquam vulputate ante justo, at auctor elit
porttitor et.
</p>
<h4>Lorem impsum</h4>
<p>
orem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum iaculis rutrum pharetra.
Fusce id massa quis felis rutrum scelerisque eget a odio. Sed imperdiet, turpis vel mollis
pretium, lorem ipsum venenatis metus, nec consectetur quam quam blandit nibh. Suspendisse
ullamcorper cursus risus, sed venenatis libero aliquet ut. Aenean auctor porttitor odio eget
sollicitudin. Vestibulum nunc turpis, porta ac libero et, egestas dapibus tortor.
Pellentesque neque augue, mattis eu orci a, tempus ornare erat. Maecenas et ultricies
tellus, eu hendrerit est. Duis feugiat libero sit amet accumsan pharetra. Nulla volutpat sem
nec sapien interdum lobortis. Praesent a tortor leo. Fusce hendrerit fringilla consequat.
Nulla at justo nec risus placerat luctus. Aliquam vulputate ante justo, at auctor elit
porttitor et.
</p>
</div>
</div>
</div>
</div>
The overflow property didn't hide my overflown content which overflows the width of the element.
HTML
<section><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc sed feugiat lacus. Morbi auctor, nibh vitae scelerisque cursus, nisl purus imperdiet lacus, quis porttitor ante mauris eget tortor. Vestibulum id molestie dui. Nullam sit amet ultrices ante. Nulla venenatis pellentesque mi, vel condimentum orci facilisis pellentesque. Aenean a enim ac dui tempus ornare eget nec nisl. In facilisis varius ullamcorper. Aliquam magna erat, pellentesque ut arcu et, accumsan placerat urna. Vestibulum porta justo ut laoreet dapibus.
Etiam dictum semper dolor, in laoreet turpis aliquam eget. Aliquam pulvinar sem lectus, vitae hendrerit libero pellentesque eu. Duis nec tincidunt felis, sed feugiat.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc sed feugiat lacus. Morbi auctor, nibh vitae scelerisque cursus, nisl purus imperdiet lacus, quis porttitor ante mauris eget tortor. Vestibulum id molestie dui. Nullam sit amet ultrices ante. Nulla venenatis pellentesque mi, vel condimentum orci facilisis pellentesque. Aenean a enim ac dui tempus ornare eget nec nisl. In facilisis varius ullamcorper. Aliquam magna erat, pellentesque ut arcu et, accumsan placerat urna. Vestibulum porta justo ut laoreet dapibus.
Etiam dictum semper dolor, in laoreet turpis aliquam eget. Aliquam pulvinar sem lectus, vitae hendrerit libero pellentesque eu. Duis nec tincidunt felis, sed feugiat.</p></section>
CSS
*, *::after, *::before {
box-sizing: border-box;
}
html, body, div, p{
margin: 0;
padding: 0;
}
section{
width: 50%;
background-color: pink;
height: 150px;
}
p{
font-size: 1em;
color: blue;
overflow: hidden;
}
Codepen :: https://codepen.io/StinsonTheNoob/pen/oNbxjWx
If your goal is to not let the <p> start on a new line and rather not overflow, you need to set overflow:hidden to your <section>.
If you want the text to disappear if it exceeds the first line on the right side of the tag then put overflow: hidden; to its parent container which, in your case is the ...
But if you want that text remains inside the container only then you have to make the tag and the "font-size" responsive so that it adapts according to the width and then will not overflow!!!
If you simply don't want any scrolling of the page then kindly put overflow in html or body's CSS commands....
I have a layout like this:
[left-image] | [title-------------------------------------]
(width up to 150) | [left-floated-p -----------[right-floated-p]
|
| lots of text................................
The only way I could implement this is by using float:left on the "left-image" and display:table-row on the contents from the right side.
The problem is that this doesn't seem to work in IE 7 :(
Are there any fixes for it? or other alternatives to implement such a layout?
note that I can't use margin-left on the right blocks because I don't know the exact size of the left image + I have 2 floats on the right side and clearing them messes up the layout...
Unfortunately IE 7 doesn't support it. A quick solution:
CSS
<style type="text/css">
#wrapper {
width: 800px;
margin: 0 auto;
}
#leftcol {
width: 150px;
}
#rightcol {
width: 650px;
}
#twocols {
overflow: auto;
}
#leftp,#rightp {
width: 325px;
}
#leftcol, #leftp {
float: left;
}
#rightcol, #rightp {
float: right;
}
</style>
HTML
<div id="wrapper">
<div id="leftcol"><img src="yourimage.jpg" /></div>
<div id="rightcol">
<h1>Title</h1>
<div id="twocols">
<p id="leftp">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sed iaculis augue. Proin accumsan tortor at dui imperdiet pellentesque. In eu purus vulputate orci porta scelerisque. Maecenas eget purus mauris, et sagittis turpis. Phasellus bibendum elit et risus dignissim gravida. Quisque feugiat mauris sit amet urna porta imperdiet. Proin feugiat rhoncus orci dictum mattis.</p>
<p id="rightp">Praesent condimentum, dolor eu aliquet adipiscing, neque est vestibulum nunc, id dignissim tortor risus sed tortor. Donec luctus scelerisque ornare. In fringilla ullamcorper erat, convallis adipiscing nulla adipiscing ut. Nunc convallis consequat tellus ut aliquam. Vivamus tortor tortor, lacinia eget dignissim sed, pharetra ac risus. Vestibulum quis condimentum turpis. Maecenas magna tellus, dignissim eu suscipit id, placerat quis metus.</p>
</div>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum lacinia, nulla quis tempus tempus, arcu velit elementum risus, consectetur rutrum diam odio vitae mi. Curabitur euismod tincidunt ipsum, id volutpat lectus bibendum eget. Nam at pulvinar felis. Vestibulum non lectus id turpis congue tempor sed eget orci. Sed pellentesque felis vitae augue cursus ac gravida arcu tincidunt. Aenean et sem lectus. Curabitur vehicula odio lorem. Morbi ultricies fermentum dolor, vitae convallis leo condimentum at. Pellentesque faucibus justo non enim varius varius. Nulla accumsan feugiat orci, egestas laoreet mauris rhoncus non. In lacinia purus in magna pulvinar et sollicitudin urna mollis. In eleifend augue ac sem suscipit eget adipiscing odio gravida. Nam tincidunt dui pharetra lacus bibendum volutpat. Integer faucibus luctus magna, et eleifend metus iaculis vitae. Cras imperdiet dignissim mi, porta elementum elit dignissim non. Ut egestas congue elit quis volutpat. Nunc ac massa neque.</p>
<p>Praesent id lectus felis. Phasellus sapien leo, ultrices nec rhoncus a, tincidunt in lacus. Mauris tincidunt volutpat nisi, quis viverra ligula pellentesque semper. Phasellus sem sem, tristique vitae sollicitudin eu, tincidunt egestas felis. Aliquam id nunc augue. Integer lectus dolor, lacinia non pellentesque non, elementum at lorem. Donec nec vulputate magna. Vestibulum lobortis risus a elit fringilla dapibus congue tellus tincidunt. Nulla a eleifend justo. Sed nec nisl augue, id vulputate ante. Vestibulum dapibus tristique nisl, non consequat nisi bibendum sit amet. Phasellus quis diam orci, et fringilla est. Morbi quis aliquam ante. Donec bibendum suscipit magna tempus feugiat. Mauris ultricies, neque sed venenatis lacinia, nulla magna scelerisque libero, vitae pharetra urna mi eget nunc. Nullam tellus quam, sagittis a volutpat id, imperdiet vel libero. Curabitur fringilla velit id ligula faucibus dapibus. Aliquam id augue leo. Aenean ac felis vel lectus commodo tempus.</p>
<p>Fusce facilisis facilisis enim et pharetra. Vivamus luctus pellentesque accumsan. Mauris sem metus, ullamcorper vel ornare in, eleifend id risus. Pellentesque viverra lacinia nulla eget hendrerit. Integer consequat egestas placerat. Etiam libero nisl, euismod in tristique ac, convallis eget purus. Nulla vulputate quam sit amet purus consectetur dapibus. Etiam aliquet purus non felis sagittis porta. Fusce id libero nibh. Ut auctor odio sed leo iaculis ut faucibus leo blandit. Maecenas imperdiet enim imperdiet elit hendrerit mattis. Etiam mauris ipsum, malesuada eget posuere eget, molestie quis sem. In commodo consequat arcu laoreet fermentum. Duis et magna massa, et molestie magna.</p>
</div>
</div>
You would need to make the text and headline prettier, but this works.
The best alternative for implementing such a layout would be using a grid framework like blueprintcss, yahoo grid etc.
I think something like this would work
<div id="wrapper">
<div id="leftImage">Hello</div>
<div id="rightSide">
<!-- Right side things here -->
</div>
</div>
#wrapper {
width:400px;
height:400px;
background:red;
}
#leftImage {
position:absolute;
width:200px;
height:200px;
background:blue;
}
#rightSide {
position:relative;
width:200px;
height:200px;
background:green;
float:left;
margin-left:200px;
}
With the same HTML code used by Gert G in his answer, here is an alternative using display: inline-block;:
#wrapper {
width: 960px;
}
#leftcol {
display: inline-block;
width: 150px;
vertical-align: top;
}
#rightcol {
display: inline-block;
width: 800px;
}
Conditional comment for IE<8
#leftcol, #rightcol { display: inline; zoom: 1; }
#rightcol can have a width of 810px IF you strip whitespace between ending tag of #leftcol and the beginning one of #rightcol
if height of title & paragraphs height are static/
just write a margin-bottom to your left image. you dont need a extra column at right of the page/
height (title & paragraphs) = X;
margin-bottom (img) = X + 100; (for your text;)
btw text should be in a division/
max-width (img) = 150px;
min-width (div.all or body) = width(img)+width(your text at right) /
In the following example, I am trying to put the child div (the pink rectangle) to lay at the bottom of its parent div.
I tried to use the suggestion that I found this stackoverflow thread but it didn't help.
Any idea?
<html>
<style type="text/css">
.a {
background: gray;
height: 80px;
}
.b {
background: pink;
float: right;
bottom: 0px;
}
</style>
<body>
<div class="a">
the parent
<div class="b"> child
</div>
</div>
</body>
<html>
make the parent "position: relative" and the child "position: absolute". Then you can position the child "right: 0; bottom: 0"
<html>
<style type="text/css">
.a {
position: relative;
background: gray;
height: 80px;
}
.b {
background: pink;
position: absolute;
bottom: 0px;
right: 0px;
}
</style>
<body>
<div class="a">
the parent
<div class="b"> child
</div>
</div>
</body>
<html>
Edit: Full HTML to show what is discussed in the comments.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
.a {
background: gray;
position: relative;
}
.b {
background: pink;
position: absolute;
bottom: 0px;
right: 0px;
}
</style>
<body>
<div class="a">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus ut quam sapien, id dictum purus. Ut vel consectetur justo. Sed suscipit justo ullamcorper diam interdum laoreet pulvinar nisl laoreet. Sed sem est, feugiat commodo bibendum vel, laoreet ac sapien. Fusce nisl nulla, commodo ut ultricies ut, iaculis a dolor. Nunc ultrices elit at tellus scelerisque vel vestibulum justo pretium. Suspendisse potenti. Suspendisse nec felis sem. Donec at tellus dolor, vehicula placerat lacus. Ut non libero at massa convallis imperdiet non rhoncus tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nunc nibh velit, congue quis tincidunt sed, feugiat a turpis. Phasellus erat justo, dictum non iaculis sit amet, auctor quis neque. Cras leo tortor, consequat non tincidunt sed, lacinia ut nibh. Etiam eu mollis quam. In eu felis velit, at bibendum sapien. Aenean sed est urna. Sed dignissim dapibus dolor sed pellentesque. Aliquam viverra ipsum sit amet justo gravida in facilisis sapien volutpat.
<p>Suspendisse commodo vulputate nunc, vitae commodo tellus varius eu. Donec adipiscing diam vel felis blandit lobortis. Donec et turpis nunc. Curabitur ac elementum mi. Aenean libero ipsum, lacinia sit amet ornare sed, sollicitudin quis libero. Vestibulum ullamcorper ullamcorper luctus. Aenean pretium ornare tempor. Sed ultricies eros sem. Aenean placerat tristique tellus nec sodales. Proin sed justo non libero condimentum commodo. Quisque sed nisl nisi, vel mattis nisl. Phasellus rhoncus pharetra egestas. Quisque nec arcu ac neque placerat rutrum. In feugiat justo ac orci dignissim rhoncus. Mauris vitae fringilla magna.
<p>Nam sagittis erat id sapien lacinia ultrices. Pellentesque ultrices, justo vitae blandit convallis, felis mi laoreet sem, in pharetra libero mauris eget nisl. Etiam in mi eget elit bibendum consectetur et nec nibh. Curabitur in justo arcu. Morbi eget venenatis enim. Duis tempor quam lacinia elit consequat sit amet blandit dolor vulputate. Aenean massa libero, suscipit eu tristique id, imperdiet pellentesque justo. Proin rutrum erat sit amet orci iaculis ut lobortis turpis sagittis. Nam luctus mollis mi, nec laoreet urna semper vitae. Pellentesque in massa enim. Etiam fermentum urna vitae lorem consequat pretium. Maecenas id ligula diam, id consectetur purus. Vestibulum libero velit, tempor hendrerit posuere ut, rutrum nec velit. Suspendisse id pulvinar erat. Sed vulputate, nibh id vulputate vestibulum, dolor elit tincidunt est, sed varius neque tellus tincidunt erat. Nunc volutpat eros in diam semper dictum. Quisque ut ligula felis.
<p>Ut pharetra feugiat nisi eu viverra. Praesent sollicitudin iaculis elit, ac lobortis ante consectetur sed. Nullam sit amet enim eget massa dapibus molestie. Donec orci diam, tempor sit amet aliquet eget, placerat in nulla. Sed et sollicitudin mi. Donec pulvinar elit pharetra urna ornare sodales. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas et mi libero. Ut et ipsum nec enim adipiscing pellentesque a nec quam. Pellentesque viverra, enim id auctor lacinia, turpis leo blandit odio, et luctus orci purus at nunc. Morbi eu sem id diam aliquam egestas. Vestibulum hendrerit lobortis est a convallis. Nunc quis quam odio, a eleifend dolor.
<p>Vivamus sollicitudin convallis diam, ut luctus ipsum viverra in. Morbi sit amet sapien urna, sit amet dictum nisi. Duis elit tortor, iaculis nec feugiat in, aliquam ut nisl. Nulla scelerisque sagittis aliquam. Ut tempus auctor tempus. Aliquam auctor vulputate volutpat. Praesent libero orci, volutpat a volutpat ac, vulputate at enim. Phasellus semper sem sed velit bibendum tempus. Aenean ut mauris nisl. Nam sit amet ipsum arcu. Phasellus pretium venenatis egestas. Ut in nulla sem. Proin aliquet facilisis lectus non consequat. Nullam vel magna et ligula viverra sagittis. Fusce in massa in quam vehicula convallis. Nullam placerat erat in nunc eleifend sed dapibus elit tempor.
<p>Aliquam in erat mi. Suspendisse dui dui, facilisis ac lobortis id, mollis quis enim. Aliquam erat volutpat. Sed in porta arcu. Maecenas aliquam congue sem, at scelerisque odio pharetra ac. In egestas rutrum cursus. Aliquam erat volutpat. Etiam a libero risus. Morbi odio eros, sollicitudin vel mattis vel, aliquet a elit. Suspendisse vel lectus risus, in iaculis ipsum. Etiam vitae justo nibh, non bibendum purus. Quisque mi erat, accumsan sit amet fringilla eu, rhoncus sed ipsum. Ut ac leo a nunc accumsan placerat at ut mauris. Aliquam imperdiet urna urna.
<div class="b"> child
</div>
</div>
</body>
<html>
In order to use the position attributes (top, right, bottom, left), the element's position CSS attribute must be relative, absolute, or fixed.
Also, the positions will be calculated relative to the element's offset parent. In order to make them relative to your .a element, it needs to have position: relative.
In your case, you need to write
.a {
background: gray;
height: 80px;
position: relative;
}
.b {
background: pink;
position: absolute;
right: 0px;
bottom: 0px;
}
.b needs position:relative; absolute would position it according to the window size, not to his parent.
there is also vertical-align which gives you a "true" bottom alignment but its only usable with table display properties like table-cell
The best way is using relative/absolute (as mentioned by a bunch of other answers). An alternative (if both the parent and child have known heights) is to set a top margin on the child:
.a {
background: gray;
height: 80px;
}
.b {
background: pink;
float: right;
height: 20px;
margin-top: 60px;
}
It's not easy to explain very well what I'm having problem with so I have attached an image:
http://test.richardknop.com/test.gif
Here is my simplified XHTML markup so far:
<div id="page">
<div id="content">
</div>
<div id="sidebar">
</div>
</div>
How to style it?
I'm getting a little bit desperate and I'm not even sure it's possible.
Like this:
#page {
position:relative;
overflow:hidden;
}
#page .images {
position:absolute; bottom:0; left: 0; width: $width-of-sidebar;
}
#sidebar {
padding-bottom: $height-of-the-image;
float:left;
}
To get background in the sidebar you'll need faux columns technique.
Richard, I think your thinking about the problem is wrong. You are thinking about these 2 items as one thing. You need to separate them.
Make footer/border a separate div and make sure it's always at the bottom. I think that's pretty straight forward.
Also make sure that your sidebar is the same size as your content. Put your images in the sidebar - and make them stick to the bottom like your footer. I usually use some sort of framework to make this easier - try out blueprint or elasticss
HTML:
<html>
<head>
<link rel="stylesheet" href="1732288.css" type="text/css" media="screen, projection">
</head>
<body>
<div id="page">
<div id="sidebar">
<div id="sidebar-content">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam congue iaculis ultrices. Nam vitae odio ut nisl dignissim pretium. Donec pulvinar gravida felis, sed pretium risus aliquet ornare. Praesent accumsan libero rhoncus tortor semper bibendum. Nunc eleifend ante turpis. Aliquam sit amet ipsum orci, sit amet convallis erat. Morbi arcu dui, ultrices vel dapibus ac, viverra in odio. Proin imperdiet sollicitudin felis vestibulum porta. Aenean ac nisi nunc, et auctor sem. Praesent vitae erat augue. Suspendisse malesuada interdum consequat. Aenean laoreet molestie elit ut placerat.
</div>
<div id="sidebar-bottom">
<div id = "image-1">
image 1
</div>
<div id = "image-2">
image 2
</div>
</div>
</div>
<div id="content">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam congue iaculis ultrices. Nam vitae odio ut nisl dignissim pretium. Donec pulvinar gravida felis, sed pretium risus aliquet ornare. Praesent accumsan libero rhoncus tortor semper bibendum. Nunc eleifend ante turpis. Aliquam sit amet ipsum orci, sit amet convallis erat. Morbi arcu dui, ultrices vel dapibus ac, viverra in odio. Proin imperdiet sollicitudin felis vestibulum porta. Aenean ac nisi nunc, et auctor sem. Praesent vitae erat augue. Suspendisse malesuada interdum consequat. Aenean laoreet molestie elit ut placerat.
</p>
<p>
Maecenas pellentesque elementum sapien, eu imperdiet turpis scelerisque pulvinar. Proin elit elit, condimentum non lacinia quis, congue vel justo. Sed rutrum magna quis neque sollicitudin vestibulum. Morbi ut eros vitae metus rhoncus sodales. Donec vel velit sed orci imperdiet tristique vel sed odio. Duis eget tellus purus. Sed blandit, tortor nec luctus tempor, tellus elit rutrum nibh, vel egestas libero velit eu libero. Nullam rhoncus, sem in ornare aliquet, dui purus consectetur felis, vitae porta elit leo et eros. Integer pharetra, mauris in lobortis aliquam, est eros commodo ante, sit amet facilisis mauris ipsum pharetra risus. Etiam vel nulla justo. Curabitur pretium facilisis consectetur. Aenean et mauris eros, nec pulvinar diam. Integer ut diam non leo ullamcorper vehicula a in mi. Curabitur adipiscing, enim feugiat porttitor pretium, lacus justo sodales odio, et congue mi sem sed ligula. Etiam accumsan accumsan tortor id pretium.
</p>
<p>
Curabitur quis nunc turpis, vitae vestibulum magna. Aliquam ultrices mi eget arcu convallis feugiat. Integer lacinia ipsum suscipit justo dapibus ultrices. Ut quis arcu vel nibh tincidunt tempus. Quisque imperdiet fermentum leo a ultrices. Donec arcu odio, congue eget elementum a, dignissim at felis. Donec in nibh dui. Curabitur adipiscing consequat urna, sed vehicula neque molestie at. Sed consequat metus velit. Nunc justo neque, tincidunt et faucibus et, mattis sit amet nulla. Integer elementum, purus in malesuada mollis, orci nisi ullamcorper nisl, quis tempor nunc augue et arcu. Integer massa metus, faucibus et vestibulum at, egestas vel enim. Integer condimentum sollicitudin sollicitudin. Nulla volutpat ultricies mauris, eget hendrerit eros accumsan ac. Suspendisse aliquam, lacus ut fringilla auctor, sem sapien elementum nulla, a hendrerit enim turpis vitae dolor. Pellentesque ac mi quis ipsum commodo venenatis.
</p>
</div>
</div>
<div id = "footer">
footer
</div>
</body>
</html>
CSS:
body{
background: #eee;
}
#page{
background: #cccccc;
width: 800px;
}
#sidebar{
background: #999;
width: 200px;
height: 100%;
margin-right: 10px;
float: left;
}
#sidebar-content{
height: 90%;
}
#sidebar-bottom {
height: 50px;
vertical-align: bottom;
}
#image-1{
width: 100px;
float: left;
}
#content{
height: 100%;
left: 200px;
background: #333;
}
#footer{
background: #3ee;
}
You can play around and make it centered and such - but this is the gist of it without using any frameworks.
Here is the solution online :
http://www.gorbikoff.com/stuff/1732288.htm
Css is at:
http://www.gorbikoff.com/stuff/1732288.css