Showing posts with label CSS. Show all posts
Showing posts with label CSS. Show all posts

Wednesday, 8 August 2012

Make Footer Stick to Bottom of Page

It is often required to keep footer stick  to the bottom of page.

Here I have given Sticky footer which always sticks to the bottom of page when your page content is not tall enough to stretch the body/container of page.

If your webpage contains enough content then it may not create problem but when content is not enough it will not appear at bottom where exactly it has to be. It just appear next to where your page gets over. This looks not good in page design.

Here with following code I have given solution for making footer stick to bottom.


Stylesheet Code 

*{margin:0;padding:0} /* To remove extra spacing */
html,body{
min-height:100%;
height:100% /* For Older browser height */
}
#body{
min-height:100%;
width:960px;
margin:0 auto;
font-weight:bold;
}
#content{
padding-bottom:100px;/* This vary with your footer size */
}
#footer{
width:960px;
margin-top:-100px;/* Footer height as per above padding(Negative Val) */ 
margin-left:auto;
margin-right:auto
}



Now Look at the HTML Code


<div id="body">
    <div id="content">
   <h1>Mukund Topiwala</h1>
    </div>
</div>
<div id="footer">
    Here is your Footer
</div>


Here is the sticky footer page view. How its look in your browser

Stick footer to bottom of page

tested in IE9, Mozilla firefox, Chrome 16

Thursday, 8 March 2012

ROUNDED CORNERS AND SHADOWED BOXES


CSS3 will have properties to make rounded borders, borders consisting of images and boxes with shadows, but with some work you can simulate some of them already with CSS2 — and without any tables or extra mark-up.
Of course, rounded borders and shadows will be much simpler with CSS3. For example, to give a paragraph a thick red border with rounded corners, you would need just two lines of CSS3 similar to this:
P { border: solid thick red;
    border-radius: 1em }
And to add a blurry drop shadow half an em below and to the right of the paragraph, just one line would be enough:
P { box-shadow: black 0.5em 0.5em 0.3em }
(You can try here if it works already.) But if you need them now and you don't mind the complexity and lack of flexibility, you can use the technique below. At the very least it will be a nice test for buggy browsers…

FIVE IMAGES ON ONE ELEMENT

The main trick is to use generated content (':before' and ':after') to put four extra images on an element. The ':before' pseudo-element can have a background and a foreground image, the ':after' pseudo-element also, and the element itself can have a background, for a total of five images.
We create five PNG images and put them in the four corners and against the right edge of the element. Here are the images:
top left corner: 
top left corner
top edge and top right corner: 
top right corner
middle part and right edge: 
background and right edge
bottom left corner: 
bottom left corner
bottom edge and bottom right corner: 
bottom and bottom left corner
And here are the CSS rules to position them:
blockquote {
    max-width: 620px;
    background: url(rs-right.png) right repeat-y }
blockquote:before {
    display: block;
    line-height: 0;
    background: url(rs-topright.png) top right no-repeat;
    content: url(rs-topleft.png) }
blockquote:after {
    display: block;
    line-height: 0;
    background: url(rs-bottomright.png) bottom right no-repeat;
    content: url(rs-bottomleft.png) }
Since our background image is 620px wide, we can't allow boxes wider than 620px, without getting gaps. That's why the 'max-width' property is there. The 'display: block' property is needed to make sure the generated content forms boxes of its own above and below the main content, instead of being inserted on the first and last line. The 'line-height: 0' makes sure there is no room for left open for ascenders and descenders above and below the images in the 'content' property.

THE RESULT

And here is how it looks:
Do you see a pale green box with rounded corners and a drop shadow against a white background? If not, your browser isn't handling the generated content correctly (or maybe not at all).
The HTML source is really no more than it should be:
<blockquote>
<p>Do you see a pale green box with rounded corners
and a drop shadow against a white background? If not,
your browser isn't handling the generated content
correctly (or maybe not at all).
</blockquote>

53 CSS-Techniques You Couldn’t Live Without


CSS is important. And it is being used more and more often. Cascading Style Sheets offer many advantages you don’t have in table-layouts – and first of all a strict separation between layout, or design of the page, and the information, presented on the page. Thus the design of pages can be easily changed, just replacing a css-file with another one. Isn’t it great? Well, actually, it is.
Over the last few years web-developers have written many articles about CSS and developed many useful techniques, which can save you a lot of time – of course, if you are able to find them in time. Below you’ll find a list of techniques we , as web-architects, really couldn’t live without. They are essential and they indeed make our life easier. Let’s take a look at 53 CSS-based techniques you should always have ready to hand if you develop web-sites. Links checked: June/11 2008.
You might want to take a look at the article Powerful CSS-Techniques For Effective Coding.
CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique
8. CSS Shadows (CSS Shadows Roundup)
CSS-Technique
CSS-Technique
10. Drop Cap – Capital Letters with CSS
CSS-Technique
11. Define Image Opacity with CSS
CSS-Technique
CSS-Technique
CSS-Technique
14.CSS Diagrams
CSS-Technique
CSS-Technique
16. Footer Stick allows for the footer of a Web page to appear either at the bottom of the browser window or the bottom of the Web page content – whichever is visually lowest.
CSS-Technique
CSS-Technique
CSS-Technique

CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique
29. CSS-Submit Buttons
CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique

CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique
CSS-Technique