I have 3 vertically aligned div (header, content, footer)
<div id="container">
<div id="header"> </div>
<div id="content"> </div>
<div id="footer"> </div>
</div>
Like this:
Just like in this example: http://jsfiddle.net/jS6pa/2/
(Example from here: http://peterned.home.xs4all.nl/examples/csslayout1.html)
As you can see in the jsfiddle example, I'm unable to complete all the requirements. The footer div doesnt collapse the content when I resize the window. If I make some tweeks I can achieve this but then the overflow:scroll doestn work and the scrollbar is not displayed
Here is another way I tried to solve this ( with no succes :S ) : http://jsfiddle.net/rv4XS/31/
I dont know if one way or another is the best approach to solve this. Just check the first or the second jsfiddle to see which one is the best
How can I achieve a full height content in a scenario where the header has dynamic content and at the same time, show a scrollbar when the content is overflow?
Thanks in advance for any help.
Ok I finally achieve this, using javascript.
The idea is simple. The height of the header has to be setted, no matter what.
For this I dont know why (maybe because this div was called in ajax) but the jquery .height() method didnt worked for me, but using the clientHeight method worked for me well.
var header = document.getElementById('headerDiv');
if(header)
{
$('contentDiv').css('top', header.clientHeight);
}
Related
Im trying to make my sidebar content follow the scrolling but stop at the footer. Currently, any content i place goes too far and overlaps the footer.
<div class="row row-no-padding">
<div class="col-lg-8">
Content is here.
</div>
<div class="col-lg-4">
Sidebar content would be here. I want all content here to follow my scrolling
but stop if if i go too far(stop at the footer).
</div>
</div>
Please help me with this. I know this is a minimalist example but i've tried so many combinations at this point that i dont know what the hell to write.
I've tried position:fixed but it makes the content overlap the footer. position:sticky doesnt do anything, or im not using it properly.
would like to solve this problem somehow nicely.
<div class="leftmenu">
some menu
</div>
<div class="content">
some content
</div>
Well.. and the question is, what to write into css file to have "leftmenu" under "content" when resizing?
Assume that media query is in use, divs are next to each other before resizing and "leftmenu" above "content" after resizing.
Thanks a lot!
jiri
EDIT1:
the fiddle is here: http://jsfiddle.net/nkkojmdf/2/
what I would like to have is yellow "leftmenu" under blue "content".
EDIT2:
"under" in previous is meant in 2D.
Well, finally found the solution
display : flex
was what I wanted: http://jsfiddle.net/nkkojmdf/4/
Anyway, thanks for help!
Sorry guys I made new one for this because it couldn't be done like I previously explained.
I want image to go over previous div and so it stays always at the same exact spot.
It's an border image for portfolio div what I'm trying to align here correctly, so that it makes peek kind of effect over previous div.
<div id="previous">some content</div>
<div id="portfolio">
<div class="some-other-content">Whole lot of html</div>
</div>
Link to my jsfiddle
Use in your CSS
"position:absolut" to set a fix position in your Window.
see more options here:
http://www.css4you.de/position.html
I am using JQuery UI to re-size a div vertically only (dragging from the bottom edge. I set the div height:200px and overflow:auto.
The JQuery looks like this:
$("#resizable").resizable({handles: 's',ghost: false,animate: false,});
$("#resizable" ).resizable({ maxHeight: 300 });
The re-size function works great while the div is empty or has content but no overflow. if however there is an overflow, the drag handle moves out of place up (from the bottom) as I move the scroll bar down. It does not stay on the bottom edge which drives me crazy because it makes it unusable.
I can not figure out how to fix this. Could some one please help out?
Thank you!
HTML:
<div id="resizable" class="divTop">
<div class="dataView">
<?php require_once(ROOT_PATH.'user/controls/data/get_data.php'); ?>
</div>
</div>
Did you try putting a the content inside another div which is(for example) 90% of the resizable div?
jQuery methods modify the HTML, they aren't magic. Look at the new HTML in Firebug and find ways to work around it.
Ok, this is really annoying and I can't understand why this is even happening.
I may have screwed some stuff up when trying to get the CSS Sticky footer to work.
I had one going on, but it seemed at the body wasn't liquid so I thought I'd try this one:
http://ryanfait.com/sticky-footer/
But the results ended up like this:
http://www.serverbart.com/film/
The blue box is supposed to resemble a gallery, so nevermind the color :p
I guess you'll understand what I'm trying to do, and I'm open for input about redesigning the div structure! I'm trying to get really good at different layouts and this one has been bugging me a bit.
You are not following Ryan Fait's example. For starters, the push goes inside wrapper.
It's because you have this:
<div id="mainWrapper">
<div id="content"></div>
<div id="push"></div>
<div id="footer"></div>
</div>
It took me forever to figure out what i was doing wrong the first time i created a sticky footer as well and it has to be like this
<div id="mainWrapper">
<div id="content"></div>
<div id="push"></div>
</div>
<div id="footer">
</div>
You have to explicitly have 2 divs as your outermost divs, not just one main wrapper.
The height for the push and the footer must be the same. The push must go inside the wrapper.