Translate Page To German Tranlate Page To Spanish Translate Page To French Translate Page To Italian Translate Page To Japanese Translate Page To Korean Translate Page To Portuguese Translate Page To Chinese

URL Services - Feature Rich and FREE


Eclipse Domain Services


Surf Anonymously and Protect Your Security and Identity
  Number Times Read : 293    Word Count: 1149  

A1 DeleteMe (0)
Ancient History (0)
Animals (46)
Arts (8)
Automotive (25)
Basketball (0)
Business (94)
Communications (19)
Computer (65)
Consumer Needs (2)
Daily Living (3)
Employment (9)
Entertainment (48)
Environment (9)
Fashion (13)
Finance (115)
Food and Beverage (6)
Health and Fitness (200)
Hobbies (12)
Home and Family (131)
Investigations (0)
Real Estate (7)
Recreation (1)
Reference and Education (31)
Relationships (41)
Self Improvement (61)
Shopping (16)
Society (5)
Sport (22)
Technology (11)
The Unexplained (1)
Travel (38)
Writing and Speaking (9)
 
Stats
Total Articles: 1160
Total Authors: 3965
Total Downloads: 437550


Newest Member
John Woodfield
 

Traffic TREAT

Traffic Lottery

How I use the most STUNNING Viral Marketing twist ever seen. Free Download and No Signup Required

Twitter Marketing System






    Seven CSS Layout Tips.

[Valid RSS feed]  Category Rss Feed - http://www.articles-galore.com/rss.php?rss=123
By : sudesh wadhwa    99 or more times read
Submitted 2009-08-16 09:11:11
The most difficult thing in CSS to get right is the layout of your site. Here are a couple of tips dealing just with that. Some of these tips are not exactly new, or rocket science, but hopefully they will save someone a bit of bother somewhere!

Tip 1: Clear out the default padding and margin settings before you start working.

Different browsers have different default margin and padding sizes so you want to start with a clean slate, so to speak. Use this command:

*

{

Margin: 0;

Padding: 0;

Border: 0;

}

to clear all default margin and padding settings. Also note the border, which is set to 0. Please note that if you do this, you will also get rid of the pesky purple border round click-able images, although some people argue that the purple border is necessary for accessibility and usability.

Tip 2: To center your layout, use a container div to contain all your content

Declare it as follows:

#container

{
Margin: 0 autos;
Width: xxxpx;
}

There are a couple of points here to take note of. DO NOT declare the width to be 100%. This defeats the whole object since you will just have to declare the sub elements within the container and then center THEM using margin : 0 auto. This is VERY BAD since.

Tip 3: Work from the top down

Literally start working on your CSS layout starting from the top most elements in your design, as well as the 'top' elements in your HTML, such as the body, as well as your main containers.

Tip 4: Document what you are doing and use Firebug and the Firefox browser to debug

You are not writing your CSS code just for yourself, some day some poor sod will have to debug it. Make numerous comments inside your CSS file to explain why you are doing things in a specific way.

Fitting in with this, you might find yourself having to fix someone else's CSS more often than you think (or even your own, for that matter). Use the Firebug add-on for Firefox to debug your CSS. This is a life-saver with regards to giving you an insight into exactly where your design might be broken and why.

The only problem with this is that your design might work perfectly in Firefox, but not in IE5, IE6 or IE7. This brings us to the next tip.
The most difficult thing in CSS to get right is the layout of your site. Here are a couple of tips dealing just with that. Some of these tips are not exactly new, or rocket science, but hopefully they will save someone a bit of bother somewhere!

Tip 1: Clear out the default padding and margin settings before you start working.

Different browsers have different default margin and padding sizes so you want to start with a clean slate, so to speak. Use this command:

*

{

Margin: 0;

Padding: 0;

Border: 0;

}

to clear all default margin and padding settings. Also note the border, which is set to 0. Please note that if you do this, you will also get rid of the pesky purple border round click-able images, although some people argue that the purple border is necessary for accessibility and usability. But lots of people do not like the purple border round images, and this is one way that you can get rid of it in one fell swoop without having to set img border=0 for each image .

Tip 2: To center your layout, use a container div to contain all your content

Declare it as follows:

#container

{
Margin: 0 autos;
Width: xxxpx;
}

There are a couple of points here to take note of. DO NOT declare the width to be 100%. This defeats the whole object since you will just have to declare the sub elements within the container and then center THEM using margin : 0 auto. This is VERY BAD .

Tip 3: Work from the top down

Literally start working on your CSS layout starting from the top most elements in your design, as well as the 'top' elements in your HTML, such as the body, as well as your main containers.

Declare your CSS commands on the highest level possible and try and declare something once only and let it cascade throughout. Only override the commands at a lower level when strictly necessary. This prevents a verbose CSS file that is difficult to maintain and understand. For example, if you have {margin: 0 auto} settings on each and every sub div within your container - you are in trouble.

Tip 4: Document what you are doing and use Firebug and the Firefox browser to debug

You are not writing your CSS code just for yourself, some day some poor sod will have to debug it. Make numerous comments inside your CSS file to explain why you are doing things in a specific way.

Fitting in with this, you might find yourself having to fix someone else's CSS more often than you think (or even your own, for that matter). Use the Firebug add-on for Firefox to debug your CSS. This is a life-saver with regards to giving you an insight into exactly where your design might be broken and why.

The only problem with this is that your design might work perfectly in Firefox, but not in IE5, IE6 or IE7. This brings us to the next tip.

Tip 5: Decide which browsers you are going to build your CSS for and test from the start

Some purists insist on making sure that your website work for all possible browsers, others only makes it work for the 'major' browsers. How do you know exactly which browsers are used the most? Once again W3 Schools come to the rescue.

Tip 6: Here is an embarrassing little tip for fixing your CSS in IE6 or IE7

Let's say your design works perfectly in Firefox, but is broken in IE6. You cannot use Firebug to determine where the problem might be since it WORKS in Firefox. You do not have the luxury of using Firebug in IE6, so how do you debug an IE6 or IE7 style sheet? I often found that it helps to add {border: 1 px solid red} or {border: 1 px solid purple} to the problematic elements.

Tip 7: Understand floats

Floating of elements is essential to understand, especially in the context of getting your floated elements to work in the different browsers!

Basically elements such as dives are floated to the left or the right (never to the top or the bottom, only sideways). Here are a couple of things to take into consideration with floated elements. Each floated element must have an explicit width specified.

Conclusion

These CSS tips for layout should hopefully save you some time and effort when you next have to panel-beat a table-less design into submission!
Author Resource:- Did you find this article useful? For more useful tips and hints, points to ponder and keep in mind, techniques, and insights pertaining to credit card, do please browse for more information at our websites. http://www.yoursgoogleincome.com http://www.freeearningtip.com
Article From Articles Galore
Related Articles :

HTML Ready Article. Click on the "Copy" button to copy into your clipboard.




Firefox users please select/copy/paste as usual
 
Sign up
learn more
 
Home
Login
Submit Articles
Submission Guidelines
Top Articles
Link Directory
About Us
Contact Us
Privacy Policy
Terms of Services
RSS Feeds
Article Surplus
Mega Articles
Eclipse Articles
CyberTech Articles

Actions
Print This Article
Add To Favorites















Click here to get Free Targeted Website Traffic




 
 

 

 

Articles Galore