How to change header and footer to full width - html

I generated a default template provided by dreamweaver for HTML5. Here it is http://jsfiddle.net/9XFEB/ . I wan to change the header and footer to full width. If i give auto property the footer disappears. Help me find out what I am missing.
<body>
<div class="container">
<header>
<img src="" alt="Insert Logo Here" width="180" height="90" id="Insert_logo" style="background-color: #C6D580; display:block;" />
</header>
<div class="sidebar1">
<ul class="nav">
<li>Link one</li>
<li>Link two</li>
<li>Link three</li>
<li>Link four</li>
</ul>
<aside>
<p> The above links demonstrate a basic navigational structure using an unordered list styled with CSS. Use this as a starting point and modify the properties to produce your own unique look. If you require flyout menus, create your own using a Spry menu, a menu widget from Adobe's Exchange or a variety of other javascript or CSS solutions.</p>
<p>If you would like the navigation along the top, simply move the ul to the top of the page and recreate the styling.</p>
</aside>
<!-- end .sidebar1 --></div>
<article class="content">
<h1>Instructions</h1>
<section>
<h2>How to use this document</h2>
<p>Be aware that the CSS for these layouts is heavily commented. If you do most of your work in Design view, have a peek at the code to get tips on working with the CSS for the fixed layouts. You can remove these comments before you launch your site. To learn more about the techniques used in these CSS Layouts, read this article at Adobe's Developer Center - http://www.adobe.com/go/adc_css_layouts.</p>
</section>
<section>
<h2>Clearing Method</h2>
<p>Because all the columns are floated, this layout uses a clear:both declaration in the footer rule. This clearing technique forces the .container to understand where the columns end in order to show any borders or background colors you place on the .container. If your design requires you to remove the footer from the .container, you'll need to use a different clearing method. The most reliable will be to add a <br class="clearfloat" /> or <div class="clearfloat"></div> after your final floated column (but before the .container closes). This will have the same clearing effect. </p>
</section>
<section>
<h2>Logo Replacement</h2>
<p>An image placeholder was used in this layout in the header where you'll likely want to place a logo. It is recommended that you remove the placeholder and replace it with your own linked logo. </p>
<p> Be aware that if you use the Property inspector to navigate to your logo image using the SRC field (instead of removing and replacing the placeholder), you should remove the inline background and display properties. These inline styles are only used to make the logo placeholder show up in browsers for demonstration purposes. </p>
<p>To remove the inline styles, make sure your CSS Styles panel is set to Current. Select the image, and in the Properties pane of the CSS Styles panel, right click and delete the display and background properties. (Of course, you can always go directly into the code and delete the inline styles from the image or placeholder there.)</p>
</section>
<!-- end .content --></article>
<aside>
<h4>Backgrounds</h4>
<p>By nature, the background color on any block element will only show for the length of the content. If you'd like a dividing line instead of a color, place a border on the side of the .content block (but only if it will always contain more content).</p>
</aside>
<footer>
<p>This footer contains the declaration position:relative; to give Internet Explorer 6 hasLayout for the footer and cause it to clear correctly. If you're not required to support IE6, you may remove it.</p>
<address>
Address Content
</address>
</footer>
<!-- end .container --></div>
</body>

You can simply add a css style for your header and footer like this:
header {
width:100%;
height:20%; //your desired height
position:absolute;
top:0;
left:0;
background-color:blue;
}
footer{
width:100%;
height:20%; //your desired height
position:absolute;
bottom:0;
left:0;
background-color:blue;
}
SEE THIS DEMO
Another way to do this is to separate the header, the footer, and the body into three different divs:
<html>
<head></head>
<body>
<div id="body">
<div id="header">your header content</div>
<div id="bodycontainer">your body content</div>
<div id="footer">your footer content</div>
</div>
</body>
</html>
To display the header and the footer using the full width of the page, use this CSS:
#body
{
width:100%;
height:100%; // the desired height
position:absolute;
top:0;
left:0;
}
#header
{
width:100%;
height:20%; // the desired height
position:absolute;
top:0;
left:0;
background-color:blue;
}
#footer
{
width:100%;
height:20%; // the desired height
position:absolute;
bottom:0;
left:0;
background-color:blue;
}
The header will be at the top of your page and the footer at its bottom. Both use the entire screen width.
Check this fiddle:
Simple Demo

Try giving footer and header outside the main div.Which is ur <div class="container">
Check this
http://jsfiddle.net/9XFEB/2/

Related

Foundation 5 off-canvas full height of device

I'm using Foundation's off-canvas navigation, attempting to make a navigation that takes up the full height of the device.
By default, the height of the menu options are determined by the height of the content being shown. This means if your content is less than the height of the menu items, your menu items will be invisible.
I would like both the menu, and the height of the content section to be fixed at the height of the device. With only scrolling in the content section if needed.
Setting the height, and min-height of content area to 100% doesn't seem to have any effect - only using a fixed height e.g. 500px will change the height - but then this isn't scalable.
How is this achieved?
If I give '.inner-wrap' a fixed height, the whole thing will adjust. How can I make sure .inner-wrap takes the full height of a device?
<div class="off-canvas-wrap">
<div class="inner-wrap">
<nav class="tab-bar">
<section class="left-small">
<a class="left-off-canvas-toggle menu-icon" ><span></span></a>
</section>
</nav>
<aside class="left-off-canvas-menu">
<ul class="off-canvas-list">
<li><label>Label</label></li>
<li>link</li>
<li>link</li>
<li>link</li>
</ul>
</aside>
<section class="main-section">
<div class="section-inner">
<p>blah blah</p>
<p>test</p>
</div>
</section>
<a class="exit-off-canvas"></a>
</div>
</div>
Try if this works, first enclose the <div class="off-canvas-wrap"> in another div
<div class="page">
<div class="off-canvas-wrap">
<div class="inner-wrap">
[..]
</div>
</div>
</div>
And then set the following css,
body,html{
height:100%;
width:100%;
}
.off-canvas-wrap,.inner-wrap{
height:100%;
}
If you want to block scrolling, say for a chat client, set .page height to 100%. And that would be
body,html{
height:100%;
width:100%;
}
.off-canvas-wrap,.inner-wrap{
height:100%;
}
.page{
height:100%;
}
This is the best way I've found and its pretty simple and non-hackish
NOTE: this only works on some css3 browsers. Compatible Browsers
Sass Version:
.off-canvas-wrap {
.inner-wrap{
min-height: 100vh;
}
}
CSS Version:
.off-canvas-wrap, .off-canvas-wrap > .inner-wrap {
min-height: 100vh;
}
Edit:
Foundation 6 sites version
.off-canvas-wrapper-inner, .off-canvas{
min-height: 100vh;
}
I had the same problems and this is what i've done:
i put .off-convas-wrapper , .inner-wrapper and aside out of my main content and just use .right(left)-off-canvas-toggle inside my body and my problem has solved.
with this way i dont need contents anymore.
BTW i put .exit-off-canvas at the end of my main content befor closing inner-wrapper tag
I had to hack the JS a bit, I found that depending on when the content is taller than the browser/device height or does not push to 100% height there were issues. Here’s my suggested fix: https://github.com/zurb/foundation/issues/3800

How to overlap sidebar on top of nav-bar

Sorry, I couldn't post images without a higher reputation, so I linked them below:
PSD:
HTML:
Okay, the PSD screenshot is of what I want the alignment to do.
And the HTML screenshot is it's current form.
As you can tell, the sidebar is currently below the orange bar (nav) and the grey bar (banner). I know there is a way to make its position absolute and overlay it on top, but seeing that this is built on a responsive grid, I think that would ruin it.
Does anyone know of anyway to overlap the sidebar like it is shown in the psd without ruining the responsiveness?
I'm open to any and all suggestions.
Thanks!
Code:
<div class="container">
<div class="row">
<header> content </header>
</div>
</div>
<nav> content </nav>
<div class="container">
<div class="row">
<div class="col-sm-9">
<section>
<!-- Services Section Content -->
</section>
<services>
<!-- Clients Section Content -->
</section>
<section>
</div>
<div class="col-sm-3">
<!-- Sidebar -->
</div>
Using position:absolute would not ruin your responsive layout if you edit your media queries to compensate.
Alternately, try a negative margin on the sidebar element and set the z-index to be higher than the top bar element. Example:
header {
width:100%;
height:100px;
background:#ccc;
z-index:100;
}
.col-sm-9 {
width:200px;
height:500px;
margin:-50px 0 0 0;
background:#000;
z-index:200;
}
Have a fiddle: http://jsfiddle.net/68ANR/
It will perfectly works.Try it because position:absolute give the position to the main div or the parent div.
.col-sm-9 {
position:absolute;
left:/*give here from left*/px;
top:/*give here from top*/px;
width:200px;
height:500px;
background:#000;
z-index:200;
}
Hope the answer !

absolute positioning on Ipad

I'm working in a web site, but it's the first time that a client ask me for ipad compatibility. So I started to work like usual but at the moment to see the result on the ipad there are some objects that i can't put in the correct position.
I already tried to change all my absolute positioning with margins and paddings, but this part(image above) does not work, when i change the position the content stay in the same place.
The current web site
The current css
But the important part is here:
<div id="super-wrapper">
<div id="wrapper">
<!-- Some Divs -->
<div id="content" class="open">
<!--This menu will be hidden -->
<ul id="navigation-fans">
<li id="registrate"><span>Registrate</span></li>
<li id="crea-club"><span>club</span></li>
<li id="conoce-clubs"><span>clubs</span></li>
</ul>
<div id="close-open" class="open"></div>
<div id="title"></div>
<div id="real-content"></div>
</div>
<!-- Some Divs -->
</div>
</div>
css
#wrapper{
width:1024px;
height:768px;
margin: 10px auto;
position:relative;
background: url(../../pics/1.jpg) no-repeat;
overflow:hidden;
}
#content{
background-image:url('../images/secciones_fondo.png');
height:423px;
width:1024px;
display:block;
position:relative;
right:-374px;
padding-top:1px;
margin-top:143px;
}
/* This is the position of #content when is open */
element.style {
right: -374px;
}
Update
I found that the problem is jplayer, but i still don't know wich is the real problem, by the moment i disable it and it works.
it might be your super-wrapper tag that you are not assigning correct properties to. If you look at the code, super-wrapper is essentially holding the same as wrapper, correct? If so, wrapper could be inheriting properties from super-wrapper which you might not be what you want.
Hope this helps.

have the content div be always centre aligned no matter what the window size is and regardless of whether the sidebar is there

I would like to have a specific layout but don't know how to fix it up in CSS.
here is my code:
<html>
<body>
<div id="outer" style="text-align:center;">
<div id="mainContent" style="background-color:red; width:700px; margin-left:130px;
display:inline-block;">
<p>A Lot of Text Here. Yes, A Lot of Text. Gotta Love it. More Text.</p>
</div>
<div id="rightNav" style="background-color:blue; width:130px; display:inline-block;">
<p>Some Text</p>
</div>
</div>
</body>
</html>
Now the problem is:
I want to have the content div be always centre aligned no matter what the window size is and regardless of whether the sidebar is there. The content is around 700px and the sidebar around 130px. The sidebar needs to sit to the right of the content.
Now I have managed to accomplish the above, but the tricky problem is how can I fix this so that when the window size is say 830px (700+130) that all content is visible and half of the sidebar is not cut off due to the content div being centred.
I hope I have explained this clearly enough.
Update: I have update the code to include CSS. As you can see the red section is centered, the blue to the right. This is what I want, expept when the window gets too small, I always have a minimum of a 130px gap on the left which is not what I want. (but had to put it in there to get the layout aligning right)
Something like this may help
<html>
<body style="overflow:hidden;">
<div id="mainContent" style="overflow:auto; position:absolute; top:0px; left:0px; right:130px; bottom:0px;"></div>
<div id="rightNav" style="overflow:auto; position:absolute; top:0px; width:130px; right:0px;"></div>
</body>
</html>
Edited:
#Nathan Arthur was so kind to add a nice fiddle to demonstrate the solution above.
...Demonstration of this in action: jsfiddle.net/2QQtU Try moving the middle divider to see the magic.
CSS
#outer {
position:relative;
width:830px;
margin:0 auto;
}
#content, sidebar {
float:left;
}
#content {
width:700px;
background-color:#afa;
}
#sidebar {
width:130px;
background-color:#faa;
}
That's all :)
*EDIT* just added background-colors to see the example better.
It appears what I want is not possible in a single solution. I will need to use conditional CSS to accomplish this.

Print css stylesheet - div positioning

Hi I have just completed my site. I'm having problems with my print style. My html is as below:
<div id="container">
<div id="main">
<h1>title</h1>
<div class="blockright">image in here and text</div>
<p>paragraphs of text</p>
<div class="blockleft">image in here and text</div>
<p>Even more paragraphs of text</p>
<div class="clear"></div>
<div class="footer">Copyright here</div>
</div>
</div>
.blockright has af ixed width and floats right
.blockleft has a fixed width and floats left has a width of auto
.main has a width and houses the content
In my print css, i would like .blockleft and .blockright to be aligned to the bottom of the printed page before the footer. Each page on the site has to be printable and I don't want to manually reposition the page to print the article or have to have a custom style for each page to print properly. Does anyone know how to get a div aligned to the bottom of the page. I tried absolute positioning but I could not get it to work. Any ideas?
Many thanks in advance
in your print style sheet
#main {
position:fixed;
bottom:0;
left:0;
display:block
}
If you don't want all of #main to go to the bottom just wrap another div around .blockleft and .blockright and apply this css to it. Alas this will probably not work in IE6, however you may try applying some of the techniques used to apply a sticky footer to a page. here's one example http://ryanfait.com/sticky-footer/