HTML CSS - Layout breaks on zooming - html

I have some problem with my layout. It looks good on my computer when I zoom to 100%. But when I zoom in or out the layout breaks. I tried several ways to wrap the layout but it didn't work so far. Since I need the layout to be responsive, any help is appreciated.
html:
<body>
<div class="low_wrapper">
<div id="intro" class="category">
<p><span class="category_description"><h1>Intro</h1></span></p>
<div class="low_info_header" >head</div>
<div class="low_info_element_big"></div>
<div class="low_info_element_big"></div>
<div class="low_info_header" >head</div>
</div>
<div id="women" class="category">
<h1>Women</h1>
<div class="low_info_header" >head</div>
<div class="low_info_element_big"></div>
<div class="low_info_element_big"></div>
<div class="low_info_header" >head</div>
</div>
</div>
</body>
css:
body{
margin: 0 0 0 0 ;
}
.category h1{
float:left;
width:940px;
font-family:'Open Sans';
}
.low_wrapper{
position:absolute;
margin-left:30px;
margin-top:30px;
position:absolute;
}
#low_info{
margin: 0 0 0px 33px;
width:940px;
background-color: #ccc;
float:left;
}
.low_info_header{
width:940px;
height:120px;
background-color:#FF0A83;
float:left;
position:relative;
}
.low_info_element_big{
height:400px;
width:460px;
background-color:#FF0A83;
margin-top:10px;
margin-right:20px;
margin-bottom:10px;
float:left;
position:relative;
}
http://jsfiddle.net/MsUTp/1/

In your .css you are giving your elements specfic sizes with px. If you want your layout to resize with your screen you should apply size to your elements using % (i.e a percent of the screen size). This way when your screen size changes, your elements will resize relative to it keeping your layout the same.

Try this
body {
margin: 0 0 0 0 ;
}
.category h1 {
width:940px;
font-family:'Open Sans';
}
.low_wrapper {
position:absolute;
margin-left:30px;
margin-top:30px;
position:absolute;
}
#low_info {
margin: 0 0 0px 33px;
width:940px;
background-color: #ccc;
float:left;
}
.low_info_header {
width:100%;
height:120px;
background-color:#FF0A83;
position:relative;
}
.low_info_element_big {
height:400px;
width:460px;
background-color:#FF0A83;
margin-top:10px;
margin-right:20px;
margin-bottom:10px;
position:relative;
}

I'd add in a .wrapper class and change .low_wrapper { position:relative} instead of absolute
.wrapper {
width:960px;
}
.low_wrapper {
position:relative;
margin-left:30px;
margin-top:30px;
}
see example: http://jsfiddle.net/MsUTp/2/

Related

Divs not aligning (CSS)

I am having extreme difficulty organizing two divs.
I have a footer, which includes two paragraphs. I want paragraph 1 hugging the left border of the footer div, and I want paragraph 2 hugging the right border of the footer div, AND these paragraphs must be on the same line.
My problem is that my divs are behaving oddly.
I have tried floating and giving widths but nothing seems to work, the paragraphs seem to keep piling on top of eachother.
Does anybody know how to resolve this? I just want to know how to write 2 paragraphs out on the same line hugging opposite borders.
HTML:
<div id='container'>
<div id='footer'>
<div id="errors">
<p>paragraph 1</p>
</div>
<div id="other">
<p>paragraph 2</p>
</div>
</div>
</div>
CSS:
#container
{
width:90%;
margin:auto;
background-color:#F6F4F1;
border: 5px solid #00b4b4;
padding:0;
border-radius: 25px;
}
#footer
{
width:100%;
bottom:0;
color:#838B8B;
font-family:verdana;
}
#errors
{
margin-left:4.5%;
text-align:left;
color:red;
}
#other
{
text-align:right;
margin-right:3%;
display:inline-block;
}
JS FIDDLE which shows how my code is behaving oddly.
I have made changes to your fiddle https://jsfiddle.net/4vuywmn2/1/
You must float the errors div to the left and the other div to right and you must clear after the container around them closes.
To understand why you need to clear I suggest you read this answer
Is this what You want :
#container
{
width:90%;
margin:auto;
background-color:#F6F4F1;
border: 5px solid #00b4b4;
padding:0;
border-radius: 25px;
}
#footer
{
width:100%;
bottom:0;
color:#838B8B;
font-family:verdana;
}
#errors
{
margin-left:4.5%;
text-align:left;
color:red;
display:inline-block;
float:left;
}
#other
{
text-align:right;
margin-right:3%;
display:inline-block;
float:right;
}
<div id="container">
<div id='footer'>
<div id="errors">
<p>Paragraph 1</p>
</div>
<div id="other">
<p>Paragraph 2</p>
</div>
<div style="clear:both;"></div>
</div>
</div>
You have to add display:inline-block; for error class, and using float : left for error, and right for other. And, on end, after other, You have to add one more div with clear:both;, how above div float will be cleared.
Try float and position attributes like this...
#container
{
width:90%;
margin:auto;
background-color:#F6F4F1;
border: 5px solid #00b4b4;
padding:0;
border-radius: 25px;
}
#footer
{
width:100%;
bottom:0;
color:#838B8B;
font-family:verdana;
}
#errors
{
margin-left:4.5%;
text-align:left;
color:red;
float:left;
position:absolute;
left:0px;
}
#other
{
text-align:right;
margin-right:3%;
display:inline-block;
float:right;
position:absolute;
right:0px;
}
try this mate, is this what you want:
#footer
{
height: 100px;
width:100%;
bottom:0;
color:#838B8B;
font-family:verdana;
}
#errors
{
float: left;
margin-left:4.5%;
text-align:left;
color:red;
}
#other
{
float: right;
text-align:right;
margin-right:3%;
display:inline-block;
}
https://jsfiddle.net/4vuywmn2/5/

Trick Web Design (Full Screen & Non Full Screen Elements)

UPDATE
After doing some testing and localhost modifications I have found out what I need:
The website must not be scrollable, only the content area.
When zooming the sidebar height should stay consistently to the bottom of the page.
The header must also zoom in and out but remain full width
Fiddle:
http://jsfiddle.net/dkx2q/2/
Something like this maybe:
CSS
body{
background-color:rgb(0,0,0);
}
#container{
display:block;
width:100%;
height:100%;
}
#fullScreenImage{
float:left;
width:25%;
height:100%;
background-color:rgb(124,197,118);
position:relative;
}
#content{
float:left;
width:75%;
height:100%;
}
#header{
display:block;
height:15%;
background-color:rgb(94,142,178);
position:relative;
}
#sidebar{
float:left;
height:85%;
width:20%;
background-color:rgb(162,94,179);
position:relative;
}
#contentArea{
float:left;
width:80%;
height:85%;
background-color:rgb(255,255,255);
position:relative;
}
span{
position:absolute;
top:50%;
width:100%;
text-transform:uppercase;
font-weight:bold;
font-family:Helvetica, 'Helvetica Neue', 'Arial Block', Arial;
font-size:9em;
text-align:center;
}
#header span{
font-size:7em;
top:40%;
}
HTML
<body>
<div id='container'>
<div id='fullScreenImage'><span>Full Screen Image</span>
</div>
<div id='content'>
<div id='header'><span>Header</span></div>
<div id='sidebar'>
<span>Sidebar</span>
</div>
<div id='contentArea'><span>Content Area</span></div>
</div>
</div>
</body>

Three column div problems?

I have a page with three columns. They're all fluid:
#LeftColumn
{
display:table-cell;
float:left;
padding-left:0;
padding-right:16%;
padding-top:0;
padding-bottom:1%;
margin-right:1%;
margin-left:0;
margin-bottom:0;
margin-top:0;
position:static;
}
#RightColumn
{
display:table-cell;
float:right;
padding-right:0;
padding-left:16%;
padding-top:0;
padding-bottom:1%;
margin-left:1%;
margin-right:0;
margin-bottom:0;
margin-top:0;
}
#Content
{
display:table-cell;
width:auto;
}
In the page they are represented as follows:
<div id="LeftColumn">
</div>
<div id="RightColumn">
</div>
<div id="Content">
<!-- Stuff goes here -->
</div>
I've created a few pages in my project with this layout, and it worked rather well. However, there's a problem: The middle column only expands when I put text in it. Thus, when I place something such as a horizontal ruler in it, it's only as wide as the previous and following paragraphs. I want the center div (#Content) to be as wide as the space between the left and right columns (#LeftColumn, #RightColumn) Is this possible?
try giving #Content display: block. and give all three divs the same height.
that will expand to fill the empty space:
http://jsfiddle.net/HMS2s/
It helps to establish a container of the objects, so their percentiles have are based off a solid, but I imagine you'll handle the media queries. The padding shouldn't be used to create width for the middle column because it will take up space which is what I believe you were trying to do? If you want equal height columns there is a really long article on this that you should check out here.
Example of this CSS
#container{
width:80%;
float:left;
}
#leftcolumn{
float: left;
width: 33%;
background-color:green;
padding: 0 0 1% 0;
margin: 0 1% 0 0;
display: table-cell;
}
#middlecolumn{
overflow:hidden;
background-color:blue;
padding: 0 1% 1% 1%;
}
* html #middlecolumn{float:left}
* html #middlecolumn #content{width:100%;}
#rightcolumn{
float:right;
width: 33%;
background-color:red;
position:relative;
padding: 0 0 1% 0;
margin: 0 0 0 1%;
display: table-cell;
}
Delete display:table-cell; from #Content and add overflow:hidden;
Something like the following maybe?
CSS
#LeftColumn
{
display:table-cell;
float:left;
padding-left:0;
padding-right:16%;
padding-top:0;
padding-bottom:1%;
margin-right:1%;
margin-left:0;
margin-bottom:0;
margin-top:0;
position:static;
}
#RightColumn
{
display:table-cell;
float:right;
padding-right:0;
padding-left:16%;
padding-top:0;
padding-bottom:1%;
margin-left:1%;
margin-right:0;
margin-bottom:0;
margin-top:0;
}
#Content
{
overflow: hidden;
}
HTML
<div id="LeftColumn">
</div>
<div id="RightColumn">
</div>
<div id="Content" class="Content">
<!-- Stuff goes here -->
</div>
Example

How to create a horizontal scroll bar when shrinking the window

If I have a content area with a width of 1225px how do I make it so that when you shrink the page to less than that width a horizontal scroll bar appears so that that center content will always be visible (at least have the option for scrolling)? Would it involve using fixed or absolute positioning?
In this site, you can see when you shrink the page, the horizontal scroll bar appears: http://www.websitecodetutorials.com/
I don't know if it helps, but here is some of my code:
<body class="fullbackground">
<img class="fullbackground" src="background.png" />
<div class="topbackground">
<div class="top">
<div class="topleft">
<img class="pf_logo" src="pathfinder_logo.png"/>
</div>
<div class="topmiddle">
<h1 class="title">Pathfinder is Temporarily Unavailable</h1>
</div>
<div class="topright" ></div>
</div>
</div>
<div class="bar"></div>
<div style="width:1225px; height:870px; padding-top:0px; margin-top:0px; margin-left:auto; margin-right:auto;">
<div class="contentcontainer">
I used a CSS reset. Here is some of my CSS:
.bar {
background-color:#365C8C;
height:30px;
width:auto;
position:relative;
padding:0 0 0 0;
margin:0 0 0 0;
overflow-x:hidden;
}
body {
position:relative;
padding:0 0 0 0;
margin:0 0 0 0;
overflow-x:hidden;
height:100%;
width:100%;
background-color:#ADCCEB;
/*background-color:black;*/
/*background: url(background.png);*
/*background-size:100%;*/
}
.bold {
font-weight:bold;
}
.contentcontainer {
width:825px;
height:870px;
margin-left:auto;
margin-right:auto;
margin-top:0px;
padding-top:0px;
/*background-color:red;*/
}
.extcontentcontainer {
width:825px;
height:645px;
margin-left:auto;
margin-right:auto;
margin-top:0px;
padding-top:0px;
/*background-color:red;*/
}
img.fullbackground {
position:absolute;
z-index:-1;
top:0;
left:0;
width:100%;
height:100%;
padding: 0 0 0 0;
margin: 0 0 0 0;
}
img.extfullbackground {
position:absolute;
z-index:-1;
top:0;
left:0;
width:100%;
height:100%;
padding: 0 0 0 0;
margin: 0 0 0 0;
}
You may try adding this property to the body tag:
overflow-x:auto;
try this:
<div style="width:1225px; height:870px; padding-top:0px; margin-top:0px; overflow-x: scroll;">
overflow property should give you your scroll bar.

100% height CSS, Fixed footer

My code is viewable at http://jsfiddle.net/ATbA5/2/ code will also be at the end of this post
I am trying to make content-wrapper 100% height however for it to be centered. I have looked at other theards on stackoverflow and Can't find a solution. Also A fixed footer at the end of the page not the bottom of the broswer window
HTML
<head>
<link rel="stylesheet" type="text/css" href="primary-resources/css/main-styles.css"/>
</head>
<body>
<div class="content-wrapper">
<!-- Header -->
<div class="header">
<div class="threetwentyleft">
<img src="primary-resources/imgs/header-logo.png" />
</div>
<div class="sixfortyright">
<div class="gameAdBanner">
<img src="game-resources/gameone/imgs/banner.png"/>
</div>
</div>
</div>
<!-- Content -->
<div class="gameLeft"></div>
<div class="gameRight"></div>
</div>
</body>
</html>
CSS
body ,html {
background-color:#000000;
height:100%;
top:0px;
bottom:0px;
clear:both;
padding:0px;
margin:0px;
}
.content-wrapper {
margin:auto;
background-color:#ffffff;
width:960px;
padding:0px;
bottom:0;px;
top:0px;
margin:auto;
box-sizing:border-box;
height:100%;
box-sizing:border-box;
clear:both;
box-sizing:border-box;
}
.header {
width:100%;
}
.threetwentyleft {
width:320px;
float:left;
padding:2px;
}
.threetwentyleft img{
width:320px;
padding:2px;
border:0px;
}
.sixfortyright {
width:630px;
float:right;
height:130px;
}
.gameAdBanner {
width:610px;
margin-top:2px;
margin-left:auto;
margin-right:auto;
}
.center {
margin-left:auto;
margin-right:auto;
}
.gameLeft {
width:700px;
padding:5px;
float:left;
}
.gameRight {
width:260px;
background-color:#CCC;
float:right;
padding:5px;
height:100%;
margin-right:3px;
}
.footer {
width:960px;
background-color:#FC6;
bottom:0px;
height:25px;
position:absolute;
}
Sounds like you want normal html behaviour, no need for any css, just add a div, or any block element after the content.