Center Box height at 90% when scrolling - html

I have a center box which is 90% of the page, this is because at 100% is leaves a blank space to scroll. Either way my issue at the moment is I have a page with quite a lot of content, and it goes off the bottom of the center box. I would set the hight to auto, but then on pages like my home page, the center box is too small on larger screens, making look bad.
Heres the CSS:
#centerBox {
width:70%;
min-height: 90%;
height: auto;
background:#ffffff;
text-align: center;
margin:0 auto;
-moz-box-shadow:0px 3px 3px 3px #737374;
-webkit-box-shadow:0px 3px 3px 3px #737374;
box-shadow:0px 3px 3px 3px #737374;
min-height:500px;
Any help will be appreciated!
Thanks,
James

firstly if upon giving 100% width, horizontal scroll comes then reset the layout
body
{
margin:0;
padding:0;
}
now, for your large content, always leave your height to auto i.e. height:auto
but it causes one problem, when there is no content, height will be too small.
what you can do is you can employ jquery to control the height.
leave entire css as it is and do this.
document.ready(function(){
if($('.content-container').height()<200)
$('.content-container').height('500');
});
where $('.content-container') points to the required div i.e. content which want to scale

Related

How to stick pop up to top in CSS

I am trying to stick my pop up to top and make it a bit smaller to fit the screen.
Here is my landing page URL - yogavoga.com/2weekdiet
Any help will be appreciated.
.modal-content {
margin: 5px auto;
background-color: #fefefe;
border: 1px solid #888;border-width:3px;
width: 90%;
}
I'm not sure if this solves your question in full, because your sample code is a bit short and it doesn't show the element itself. I tried visiting your website, but can't find the element. So it is very difficult for us to say what you actually want.
margin is the space around your div element, in this case your modal. With your code you say your browser to put your element at the top, (0 margin at the top), and do the rest automatically. It does that and will center your element based on the width of your element.
You can scale your element with width. Make it smaller by reducing the percentage.
.modal-content {
margin: 0 auto; // 0 from top, left, bottom and right auto.
background-color: #fefefe;
border: 1px solid #888;
border-width: 3px;
width: 60%; // Width of your element.
}
TIP: remove the margin and padding presets from your body to have your element at the absolute browser border.

elements get bigger when zooming in

Even though I've set a max width/height for my image element, it'll still extend upwards when I zoom in on the page. Any help here :)?
.column img {
width: 80%;
height:450px;
max-height:450px;
min-height:450px;
max-width:80%;
border-radius: 50%;
border: 1px solid black;
margin-bottom: 20px;
box-shadow: 6px 6px 6px #000;
}
website 100% view
website 120% view
I know 1 way to solve this if you want with CSS only.
With CSS: you can make break points in your page. So in resolutions that you set your page will be responsive. You can check This . And you can not use (%) for solve your problem. Only with px. If you set
height:450px;width:450px;
this will work for the circle but will not be responsive. And the px of width must be the same with height. And the BootStrap is some files that can help you with the responsive design.

Position div beneath a div that has position absolute

I want to make a header with a image in it that will use the whole width of the browser even when zoomed out. Directly under that #slider-wrapper with the image in it is the #main-content. But that div is postioned directly after #topheader now as you can see what indicates my problem. That div must be right after the #slider-wrapper (and thus ) but because #slider-wrapper is positioned absolute, the div #main-content is positioned after #topheader.
How can I get the #main-content positioned after the #slider-wrapper? Is there some other way to make the header image use the whole width of the screen instead of position absolute? Please help me with this, trying this for hours now.
I have made a jsfiddle for the first time that's not 100% correct but it will do I think. So atm the header image is using the whole screen even after zoomed out but I can't get the #main-content positioned well. Thanks alot
https://jsfiddle.net/hj28fuw7/4/embedded/result/
https://jsfiddle.net/hj28fuw7/4/
If I understand your issue correctly, I think what you need to do is set a top margin on the #main-content to the value of the height of the #slider-wrapper. i.e.
change:
#main-content {
width: 1060px;
margin: 0 auto;
border: 1px solid #000000;
}
to:
#main-content {
width: 1060px;
margin: 426px auto 0px auto;
border: 1px solid #000000;
}

Overflow with elements out of the flow

I have two divs that I have have positioned on the left and right sides of the screen (using float and/or absolute positioning, I have found many ways to position them). In the middle I have a single div that keeps the content of my website centered. My problem is that when I have my browser at a small width those outside divs are forced in and mess everything up in the center. When I have my browser at a small width I want a scroll bar to appear so that a user and scroll left or right to see the divs outside the center content. I am using overflow:scroll on the body element but that doesn't do anything. I also need to use
Here is the basic structure
<body>
<div id="navLeft">
<div id="navRight">
<centered content/all of webpage>
</body>
Here is the CSS for the body and side divs
body {
background: #A2F0FA url('images/bg_site.jpg');
background-repeat: repeat-x;
font: 13px Arial, Sans-Serif;
color: #525252;
overflow:scroll;
}
#navLeft {
border: 5px solid #fff;
width:220px;
height: 260px;
float:left;
position:absolute;
top:10%;
left:28%;
opacity:0.85;
}
#navRight {
border: 5px solid #fff;
width:220px;
height: 260px;
float:right;
position:absolute;
top:10%;
left:85%;
opacity:0.85;
}
you can try some negative margin on body's side.
but you won'nt be able to show the left aside on small screen so if content is important, you loose it :
body {margin:0 -220px ; /* width of aside element */.
Test the idea here
Best is to check via javaScript on load and resize width of window & body & if an horizontal scroll is there and its scrollright value.
Then reset the scrollright to a proper value without annoying your visitor.

need to stretch a div to height of user's browser window

newb here again,
i'm pretty sure i knew this at one point but i no longer remember.
here's my fiddle
http://jsfiddle.net/rachelcat/PHG6U/
obviously this is not the font i am using but let's deal with it.
height: 100%
^ i tried this and it makes everything dissppear.
i am aware i have the lines set to 800px which is why they stop, but without making them like "4000px" height how would i make it so it always corrects to the browser size? (whatever size that may be) without necessarily having the extra 1000 pixels when you scroll down?
i assume this has an easy answer and i'm just really dumb.
THANKS IN ADVANCE.
Set the parent elements' heights to 100%, along with the sideline divs. When using percentages, an element's height is calculated with respect to the height of the generated box's containing block.
html {
background: #FFFDDB;
margin:0px 0px 0px 0px;
padding:0px 0px 0px 0px;
height: 100%;
}
body {
font-family: 'Pompiere', cursive;
margin:0px 0px 0px 0px;
padding:0px 0px 0px 0px;
height: 100%;
}