Submitted by nima on Fri, 12/11/2009 - 13:38 Website designers have been utilizing CSS [Cascading Style Sheets] for many years now. Over and over again, however, I come across an argument that CSS offers no real advantage and whether you code with it or not is just a matter of I couldn't disagree more. If you are looking to improve the presentation of your website, CSS will help you do it more efficiently and effectively. CSS based design offers advantages that table-based layout can't compete with. And
here's how: Faster loading of pages First of all, you are separating the content of the web page which is text and images into the HTML file and the visual presentation such as the layout, style, color etc. into a CSS file. This minimizes the amount of code in the actual webpage so the loadtime is shorter. Also, designing a layout using tables requires much more HTML coding then if you were laying things out using CSS. With CSS, the usual table tags such as
"td align" or "td width" are replaced with "divs". Code for specifying margin, padding, width, height and other visual details is much more consolidated with CSS. What used to take 200 characters with HTML, may take 50 when coding with CSS. Simply because CSS have cut the use of too much markups, websites can load a lot faster than using tables which is good when attracting visitors to a website. With these two working hand in hand, the difference is substantial. Efficiency
Since the content is separated from the layout styles, redesigning is a snap with CSS. All you have to update is the CSS file and the changes will be carried across the entire structure. No more digging through the site, page by page, to update a single tag. Because the layout information is centralized, these changes can be made quickly and globally by default. Markup tags are also much easier to locate since they can be logically organized in your file. Consistency
As you only update a single file [although you can have many CSS for a single website], the style that you specify applies to any page that you want consistently, without any chance for diversion. This is most evident with positioning. Widths, heights, and margins will be handled the same by any HTML page linking to the same CSS file. You will improve your site's usability, credibility and overall user experience. SEO advantage There is a debate
whether the use of CSS has any direct impact on SEO. I would say that Google [and any other search engine for that matter] do not have any preference and will certainly not give you any advantage just because your site is CSS based. However, just because there is less code [less messy code] involved, spiders will have easier time crawling your site. And it's known for a fact that they love clean code [just as much as valid one]. Layouts and design sophistication CSS
offers freedom in designing that HTML tables never might. While tables are rigid, inflexible, and grid based, CSS-based designs are fluid, flexible and expandable. That gives designers more power and freedom to exercise their creativity. For example, CSS offers absolute positioning of elements paired with the z-index property. This allows CSS-based designs to position elements on top of one another [like layers in Photoshop], allowing for more unique, complex, and beautiful layouts. Bandwidth
efficiency A stylesheet is usually stored in the browser cache, and can therefore be used on multiple pages without being reloaded, increasing download speeds and reducing data transfer over a network. And the 7th reason why you should use CSS? All the cool people gave up tables ages ago . Here, how is that for an incentive? In case you're interested in knowing more info on casino bonus, stop by
nodepositbonus.codes
View Discussion
Improve Article
Save Article
View Discussion
Improve Article
Save Article
- HTML HTML stands for Hyper Text Markup Language and it is the language that is used to define the structure of a web page. HTML is used along with CSS and Javascript to design web pages. HTML is the basic building block of a website. It has different attributes and elements with different properties. Each element has an opening and a closing tag. We can also add images with the help of HTML.
Example:
HTML
Welcome to GeeksForGeeks
Output:
- CSS: CSS stands for Cascading Style Sheets and it is used to style web documents. It is used to provide the background color and is also used for styling. It can also be used to style the font and change its size. We can also style many different web pages with the same specifications with the help of CSS. CSS is also recommended by World Wide Web Consortium [W3C]. It can also be used along with HTML and Javascript to design web pages.
Example:
HTML
body {
background-color: red;
}
Welcome to GeeksForGeeks!
This page has red background color
- Output:
Difference between HTML and CSS:
1. | HTML is a markup language used to define a structure of a web page. | CSS is a style sheet language used to style the web pages by using different styling features. |
2. | It consists of tags inside which text is enclosed. | It consists of selectors and declaration blocks. |
3. | HTML doesn’t have further types. | CSS can be internal or external depending upon the requirement. |
4. | We cannot use HTML inside a CSS sheet. | We can use CSS inside an HTML document. |
5. | HTML is not used for presentation and visualization. | CSS is used for presentation and visualization. |
6. | HTML has comparatively less backup and support. | CSS has comparatively higher backup and support. |
7. | HTML doesn’t allow animations and transitions. | CSS allows animation and transitions which helps to improve the UI. |
8. | HTML files are saved with .htm or .html extension. | CSS files are saved with .css extension. |