I am trying to construct a page layout, where the left column has a fixed width and a height of 100% (of whatever the right column is) and the right column has a fluid width. I've tried various ways of doing it, but can't seem to get it right..
Here's my code:
<div id="pageHolder">
<div id="topSection">
header goes here
</div>
<div id="pageContainer">
<div id="leftColumn">
<div id="leftHolder">
left stuff goes here
</div>
</div>
<div id="rightColumn">
<div id="rightHolder">
right stuff goes here
</div>
</div>
</div>
<div id="bottomSection">
footer goes here
</div>
</div>
And my css is:
body {
height: 100%;
}
div#pageHolder {
}
div#topSection {
padding: 0px 0px 0px 0px;
margin: 0px 0px 0px 0px;
}
div#pageContainer {
position: relative;
width: 100%;
height: 100%;
padding: 0px 0px 0px 0px;
margin: 0px 0px 0px 0px;
}
div#leftColumn {
position: relative;
float: left;
width: 285px;
height: 100%;
padding: 0px 0px 0px 0px;
margin: 0px 0px 0px 0px;
}
div#leftHolder {
padding: 25px 25px 25px 25px;
margin: 0px 0px 0px 0px;
}
div#rightColumn {
position: relative;
height: 100%;
min-height: 100%;
padding: 0px 0px 0px 0px;
margin: 0px 0px 0px 285px;
}
div#rightHolder {
padding: 25px 25px 25px 25px;
margin: 0px 0px 0px 0px;
}
div#bottomSection {
clear: both;
}
If someone could help me out, that would be fantastic :)
Try this out:
div#leftColumn {
position: absolute;
float: left;
width: 285px;
height: 100%;
padding: 0px 0px 0px 0px;
margin: 0px 0px 0px 0px;
}
**Edit: On second thought perhaps using maxwidth and maxheight could do something to help you if you want to keep position: relative.
http://css-tricks.com/the-perfect-fluid-width-layout/
as i see the 'live example' this is what you're asking for
I believe you want to replace your body definition with body, html in your css, as well as add a height to pageHolder
body, html {
height: 100%;
}
div#pageHolder {
height: 100%;
}
It's pretty annoying though because you will get unnecessary scrollbars regardless of the content inside. Is this what you are trying to achieve?
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I am fairly new to css. I want to make concentric circles. How to do it using css? I can create 2 circles separately. I have used position: absolute
Thanks for any help.
Border is a way. but if you want to make another circle, you need something like this
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
<style>
.outer {
display: grid;
place-items: center;
background-color: skyblue;
height: 200px;
width: 200px;
border-radius: 50%;
}
.inner {
background-color: lightgreen;
height: 150px;
width: 150px;
border-radius: 50%;
}
</style>
</head>
<body>
<div class="outer">
<div class="inner"></div>
</div>
</body>
</html>
The easiest way would be to make use of a border that is half the width and height of your element itself, in combination with a border-radius that is the full width and height of your element:
.circle {
width: 20px;
height: 20px;
border: 10px solid black;
border-radius: 20px;
}
<div class="circle"></div>
.outer{
width: 200px;
height: 200px;
position: relative;
background-color: #eee;
}
.first-circle{
width: 100%;
height: 100%;
border-radius: 50%;
background-color: red;
}
.second-circle{
width: 90%;
height: 90%;
border-radius: 50%;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
background-color: black;
}
<div class="outer">
<div class="first-circle"></div>
<div class="second-circle"></div>
</div>
Next time please try to google about it before submit a question, and please you can close this request now.
body{
display: flex;
height: 100vh;
justify-content: center;
align-items: center;
}
span {
border: solid 1px transparent;
border-radius: 50%;
box-shadow: 0px 0px 0px 10px red, 0px 0px 0px 20px green, 0px 0px 0px 30px yellow, 0px 0px 0px 40px blue, 0px 0px 0px 50px skyblue, 0px 0px 0px 60px pink;
width: 100px;
height:100px;
margin: 3em;
}
<div class"container"> <span></span></div>
I have a structure like so
<div class="contentWrapper">
<div class="left_side"></div>
<div class="right_side"></div>
</div>
My contentWrapper class has this style:
.contentWrapper {
margin: 0px auto;
padding: 0px;
width: 990px;
text-align: left;
background-color: #FFF;
box-shadow: 0 2px 7px rgba(0,0,0,0.25);
position: relative;
z-index: 20;
}
but the background color and border do not appear.
My left_side and right_side class has this as styleing:
.left_side {
width: 630px;
float: left;
padding: 0 10px 0;
}
.right_side {
width: 300px;
float: right;
margin: 0 20px 20px;
}
If I turn off the float on either the left side or right side, but background and border appear..How do I fix this, I really need to background and border around both left and right side.
Thanks,
J
The class names in the css are wrong. In the html they're called left_side and right_side, while in the css you have right_column and left_column.
Fiddle
.contentWrapper {
margin: 0px auto;
padding: 0px;
width: 990px;
text-align: left;
background-color: #FFF;
box-shadow: 0 2px 7px rgba(0,0,0,0.25);
position: relative;
z-index: 20;
overflow: hidden; /* THIS /*
}
This will clear the float and basically fixing it. When you float an element it jumps out of the normal layer, causing the parent to behave as there was nothing inside it.
I don't know why but when the height of the content_second_box is set higher then the height of the screen resolution then the whole page shifts left by a few pixels. Once the div reaches the bottom of the screen it shifts, when the height does not reach then it is ok.
I have tried many things but nothing has worked. Does anyone please know why?
CSS is as follows:
body {
background-color: white;
}
#container {
position: relative;
width: 1300px;
margin-left: auto;
margin-right: auto;
padding: 10px 50x 30px 50px;
}
#content {
width: 1000px;
margin-left: auto;
margin-right: auto;
padding: 40px 0px 0px 0px;
/*text-align: center;*/
}
#content_first_box {
width: 225px;
height: 50px;
/* min-height: 160px; */
/* height: auto !important; */
background-color: #ff8b00; /*#9caad6;*/
border-radius:5px;
box-shadow: 3px 3px 5px #888888;
padding: 5px 5px 5px 5px;
overflow: hidden;
float: left;
text-align: center;
margin-right: 15px;
}
#content_second_box {
width: 225px;
height: 500px;
/* min-height: 160px; */
/* height: auto !important; */
background-color: #79bbff; /*#9caad6;*/
border-radius:5px;
box-shadow: 3px 3px 5px #888888;
padding: 5px 5px 5px 5px;
overflow: hidden;
float: left;
text-align: center;
margin-right: 15px;
}
HTML file is as follows:
<body>
<div id="container">
<div id="content">
<div id="content_first_box">text</div>
<div id="content_first_box">text</div>
<div id="content_first_box">text</div>
<div id="content_first_box">text</div>
<div id="content_second_box">text druhy</div>
<div id="content_second_box">text druhy</div>
<div id="content_second_box">text druhy</div>
<div id="content_second_box">text druhy</div>
</div>
</div>
</body>
The scroll bar appears once the page is longer than the viewport. This causes all content to shift left to allow for the scrollbar.
You can get rid of the content shift by always showing the scrollbar in browser as -
html{
overflow-y: scroll;
}
I am having a simple div with header,content and footer.Now my issue is that there is a gap at the bottom of my div.And if I resize browser window some more extra white-space is adding at the bottom of my div.
The entire leftContainer should be of browser height.
For example I need something like this(actually this is done n flash I want it to be done in HTML)
This is how it looks now:
Here is my CSS:
html, body
{
margin: 0;
border: 0 none;
padding: 0;
overflow: hidden;
}
html, body, #wrapper, #left, #right
{
height: 100%;
min-height: 400;
}
.leftContainer
{
width:308px;
max-height: 100%;
height:100%;
border-style: solid;
border-width: 2px 0px 0px 0px;
background-color: #ffffff;
box-shadow: 0px 0px 7px #292929;
-moz-box-shadow: 0px 0px 7px #292929;
-webkit-box-shadow: 0px 0px 7px #292929;
}
.mainbody
{
padding-left: 5px;
margin-top: 0;
min-height: 150px;
max-height:736px;
height: 100%;
background-color: #F9F9F9;
}
.header
{
height: 40px;
color: #000;
border-bottom: 1px solid #EEE;
}
.footer
{
padding-left:20px;
height: 40px;
background-color: whiteSmoke;
border-top: 1px solid #DDD;
-webkit-border-bottom-left-radius: 5px;
-webkit-border-bottom-right-radius: 5px;
-moz-border-radius-bottomleft: 5px;
-moz-border-radius-bottomright: 5px;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
}
HTML:
<div class="leftContainer ">
<div class="header">Header</div>
<div class="mainbody">
<p>Body</p>
</div>
<div class="footer">Footer</div>
</div>
I don't want the footer to be seperate it should be within its parent div(leftContainer)
DEMO
Have you tried adding
position: relative;
To your .leftContainer and
position: absolute;
bottom: 0;
left: 0;
right: 0;
to your .footer ? Should make what you want.
Take a look : http://jsfiddle.net/UqJTX/7/embedded/result/
There is some issue with shadows, they are added to length in some browsers, so try to put only side shadows and apply negative margin.
Have you tried adding
position: absolute;
bottom: 0;
left: 0;
right: 0;
top:0;
overflow:auto;
To your .leftContainer and
position: absolute;
bottom: 0;
left: 0;
right: 0;
to your .footer ? Should make what you want.
You have to mention the width of each div in percentages. Total left container height is 100% then decide the height for the three divs (like header 10%, body 85% and footer 5%) with appropriate percentages. Mentioning the heights or widths in pixel is not suggestible.
Use firebug for easy debugging of HTML and CSS.
check out this DEMO it works properly
Use this like min-height:100%
may it will useful to you
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 11 years ago.
In today's news, the official twitter widget (http://twitter.com/about/resources/widgets) destroyed my footer completely. And I don't know why, since that script doesn't have access to my style.css
or does it?
I have tried to rearrange and ever redo the footer, and still the nice white space that the twitter widget created still persists. WTF is happening? Of all the tweaking I've done, the only thing that seems to work is deleting the entire footer. fantastic solution!
Can anybody help me?
footer.php:
</div> <!-- End of pagewrap -->
<footer class="group">
<div id="logo"></div>
<div id="twittertitle"><h3>The Director's Production Diary #iampineros</h3> </div>
<div id="twitterbox"><div id="winfo"></div></div>
<div id="sociallist">
<ul>
<li><div id="facebooklogo"><h3>Facebook</h3></div></li>
<li><div id="twitterlogo"><h3>Twitter</h3></div></li>
<li><div id="flickrlogo"><h3>Flickr</h3></div></li>
<li><div id="vimeologo"><h3>Vimeo</h3></div></li>
<li><div id="youtubelogo"><h3>Youtube</h3></div></li>
</ul>
</div>
<div id="disclaimer">All material published in this website is property of Filmliga unless stated otherwise. Please, don’t mess with us, thank you. Copyright 2011 FIlmliga/Benjamin Piñeros. All rights reserved. This site is powored by Wordpress.</div>
</footer>
<?php wp_footer(); ?>
</body>
</html>
style.css:
#page-wrap { width:1020px; margin: 0px 0px 0px 0px; padding: 0px 0px 20px 0px; background: white; }
footer { width: 1020px; height: 300px; margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px; background-color: #1e1e1e; }
#logo { width: 221px; height: 222px;position:relative; bottom: -20px; left: 20px; padding: 0px 0px 0px 0px; background-image:url(images/logo.png); background-repeat:no-repeat; }
#twittertitle { position:relative; bottom: 208px; left: 270px; padding: 0px 0px 0px 0px; }
#twitterbox { position:relative; top: -203px; left: 270px; padding: 0px 0px 0px 0px; background-image:url(images/twitterbox.png); background-repeat:no-repeat; width: 540px; height: 190px; }
#winfo { position:relative; top: 0px; left: 0px; padding: 0px 0px 0px 0px; background:none; width: 500px; height: 180px; }
#sociallist { position:relative; bottom: 393px; left: 837px; padding: 0px 0px 0px 0px; background-color:#282828; width: 140px; height: 190px; }
#sociallist ul { margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px; list-style-type:none; list-style-image:none; }
#sociallist li { margin: 0px 0px 0px 0px; text-decoration: none; padding: 0px 0px 0px 0px; }
#sociallist li h3:hover {color: #1ad4ff; }
#facebooklogo { background-position: center; background-image: url(images/facebooklogo.png); background-repeat:no-repeat; width: 26px; height: 26px; position:relative; top: 10px; left: 103px; }
#facebooklogo h3 { position:relative; bottom: 3px; right: 90px; }
#twitterlogo { background-position: center; background-image: url(images/twitterlogo.png); background-repeat:no-repeat; width: 33px; height: 25px; position:relative; top: 20px; left: 98px; }
#twitterlogo h3 { position:relative; bottom: 3px; right: 85px; }
#flickrlogo { background-position: center; background-image: url(images/flickrlogo.png); background-repeat:no-repeat; width: 26px; height: 26px; position:relative; top: 30px; left: 103px; }
#flickrlogo h3 { position:relative; bottom: 2px; right: 90px; }
#vimeologo { background-position: center; background-image: url(images/vimeologo.png); background-repeat:no-repeat; width: 27px; height: 24px; position:relative; top: 40px; left: 101px; }
#vimeologo h3 { position:relative; bottom: 2px; right: 87px; }
#youtubelogo { background-position: center; background-image: url(images/youtubelogo.png); background-repeat:no-repeat; width: 24px; height: 29px; position:relative; top: 50px; left: 104px; }
#youtubelogo h3 { position:relative; bottom: 2px; right: 90px; }
#disclaimer { position: relative; bottom: 0px; left: 0px; margin: 0px auto; padding: 0px 0px 0px 17px; text-align: left; font-size: 10px; word-spacing: 3px; }
The problem is that you're positioning things in a pretty strange way inside your footer... you're specifying lots of top, left, and bottom values on elements that have position: relative—these elements are still causing things to lay out as if they are in the normal flow of the document (which accounts for the huge bottom gap you see), and then they're also shifted by your positioning values.
A much more common (and easier) approach is to give your footer (or .group) position:relative and then apply position: absolute to the children—that way the children will be absolutely positioned relative to the parent.
The problem lies is your layout. Your extensive use of absolute/relative positioning is messing up subsequent div placements. Consider redoing your layout.
Here's a quick fix though:
Apply to #disclaimer:
margin-top: -330px;