Weblink India.Net – Blogs

Ideas & Inspiration for web design and web development

Posts Tagged ‘Style Sheet’

CSS Optimization for a Faster Website

Posted by weblinkindia on September 2, 2010

A website’s popularity depends as much on its design and content as on its user-friendliness. A major aspect of this is the loading time of a website. Now you may ask, how does this affect the viewership? Imagine surfing the internet and coming across a website related to a highly interesting topic but the only glitch is that it is taking too long to load properly. Needless to say this compels you to close the page and search somewhere else. As for designers who make websites with elaborate coding, every effort can fall flat if their websites do not load properly or run too slow on servers. Although there are many factors that come together to increase the downloading time but today we discuss a major factor here and that is CSS optimization.

CSS or Cascading Style Sheets control the designing aspect of a website and if optimized properly these can help in the formation of a well-designed website that loads quickly to show its content. Permitting browsers to directly access information from the .css files that are related to the styles, these sheets eliminate the need for repetitive information reading, each time the page is loaded.

  1. Remove redundant coding and combine scattered codes at one place.
    Through smart coding you can drastically reduce the loading time of a webpage on a computer and if the discrete codes are combined into one then rendering occurs earlier as compared to pages with redundant coding. Also, some properties like CSS !important override should be used only if required.
  2. Use CSS Sprites.
    This enables you to store multiple images at one place and allows faster webpage loading. The combined segment can then be displayed selectively, using CSS properties of background-image and background-position.
  3. Use CSS Optimizer Tools like CleanCSS and YUI compressor to delete things like:
    • Unnecessary characters
    • Whitespaces
    • Useless properties
    • Repetitive selectors
  4. Keep all Cascading Style Sheets at one place or in a separate external file.
    This is done to trim down the requests sent to the HTTP Server and having a single file means that only one request will be sent, resulting in faster downloads to the client’s computer.
  5. Place CSS on the top of pages to load them faster.
    This is based on the fact that the CSS scripts placed here will be rendered first because the parallel downloads are blocked by scripts. This also prevents the display of blank white screen and content that has not been styled.
  6. Some other steps that can be taken include:
    • Grouping styles that are alike
    • Use CSS shorthand
    • Deleting unnecessary line breaks and comments
    • In many browsers using ‘@import’ causes WebPages to slow down so use this sparingly or better still use ‘link’

A cleaner code with smart placement definitely translates into the speedy rendering of WebPages on a server. With the further support of minification tools, you can easily increase the number of time your website is viewed by people. We will be back soon with more tips on how to make your website load faster and become more popular with web surfers. Watch this space!

Posted in CSS | Tagged: , , | Leave a Comment »

CSS differences in Internet Explorer

Posted by weblinkindia on November 28, 2009

With the coming of CSS, the world of web was refreshed and was breathed with a new life. Color, stylized fonts, borders, margins, etc. were used in order to make a web page or site attractive. There are several browsers on which web sites or pages are opened. The web developers had to test their work in different browsers so that everyone has access to their work. Internet Explorer or IE is the most accessed browsers but there are various differences in its 3 versions especially in their support of CSS.

Why designers should have knowledge of CSS differences?

Every site designed for promotion, aims to receive higher search engine rankings. For achieving it they need to apply numerous CSS tips. Here you are provided with some useful points or differences that are present in different versions of IE.

The major differences that are to be found in different versions of Explorer are:
>> Selectors & Inheritance
>> Property Support
>> Significant Bugs and Incompatibilities
>> Other Miscellaneous Techniques

Selectors & Inheritance:  Selectors are part of CSS techniques that help in optimization and saves on a lot of time. There are numerous kinds of selectors like Child Selectors, Chained Classes, Attribute Selectors, Adjacent Sibling Selectors and General Sibling Selectors. These selectors are supported by one browser and not supported by the other. All these selectors are supported by the latest versions of IE7 and 1E8 and not by IE6.

Property Support:  Different properties of CSS like Fixed-Position Elements, Transparent Border Color, Max-Height & Max-Width, Min-Height & Min-Width, Property Value “inherit”, Border Spacing on Table Cells, Rendering of Empty Cells in Tables, Vertical Position of a Table Caption, Clipping Regions Orphaned and Widowed Text in Printed Pages, Page Breaks Inside Boxes, Outline Properties, Alternative Values for the Display Property and Virtual Dimensions Determined by Position are not supported by all browsers. These properties are responsible for giving a webpage or website a new and appealing appearance. All these are supported by IE7 and IE8 and not by the older version, IE6.

Significant Bugs and Incompatibilities: There are various incompatibilities and bugs in IE6 and IE7 that a web designer must know in order to create a well-designed and optimized site.

Bugs in IE6:

  • It Doesn’t support styling of the element
  • Doesn’t support IDs and classes that begin with an underscore or hyphen.
  • It Offers only fractional support for @font-face
  • Dotted borders appear almost identical to dashed borders, etc.
  • Bugs in IE7:

  • List items for a list that is ordered, its layout will not increment their numbers
  • Offers only fractional support for @font-face.
  • List items don’t support all possible values for list-style-type
  • List items that have a specified list-style-image will not be able to display the floated image.
  • Apart from these many other bugs occur in different situations.

    Other Miscellaneous Techniques: The advanced techniques like Media Types for @import, Incrementing of Counter Values and Quote Characters for Generated Content are only supported by IE8.

    Knowledge of these differences will help a web site developer in framing a browser friendly site that will be supported by all three versions of Internet Explorer. Our CSS guideline will help your site acquire higher search engine rankings.

    Posted in CSS, Internet Browser | Tagged: , , | Leave a Comment »

    Advance CSS optimization tips and techniques

    Posted by weblinkindia on November 14, 2009

    CSS optimizationIn the present scenario, where ‘Time is Money’, people hardly wait for the sites to open. Internet is flooded with information laden sites, if one takes time to load, people switch to other. In order to avoid this to happen to your webpage or site, various CSS optimization techniques can be improvised. CSS optimization is a process that aims at reducing the extra load of WebPages or Sites, which in turn lead to their speedy loading and hence help them escalate the search engine rankings. It is updated at recurrent intervals of time so as to provide you with tips to design a site that is easy to load.

    Tips and techniques of Advanced Optimization: -
    >> Smaller style sheets
    >> CSS Sprites
    >> CSS layout and positioning control
    >> Faster tables
    >> Substitution

    Smaller style sheets :-   To minimize the loading time of the websites one has to reduce the size of the style sheets. This can be done by using Shorthand Properties, selecting and grouping similar classes that have same CSS declarations.

    > Group Selectors:-
    Selector is one of the CSS syntax, which is usually the HTML tag that we wish to define. By selecting the similar group of selectors we save a lot of time. We separate each selector with the help of a comma.
    > Selector Specificity:-
    It is a method, which is used to determine as to which set of rules should be given priority in CSS when more than one rule can be applied to an element. By using similar level of rules leads to code redundancy and style clashes. If a code is reduced by merging its common properties, lot of weight of style sheets can be lessened.
    > CSS Shorthand:-
    It is a property of CSS that allows us to state various properties using one. It eases the web designers to make concise CSS code and applies style to markup.

    CSS Sprites :-  with the help of CSS sprite, a single image file can be created that consists of many images in a grid form. Only single image is required to be placed on the webpage, while rest of the images can be shown using a property of Background Positioning.

    CSS layout and positioning control: - In order to completely optimize the HTML document one needs to transform the code from tables to CSS layout. This method will lead to faster loading of sites.

    Faster tables:-  CSS can be used to align your table and add background colors, which add style to your sheets and helps in improving the flexibility and speed of the web page or site.

    Substitution:-  CSS based effects can be substituted by JavaScript techniques like menus or rollovers and tables

    These CSS guidelines or tips will let you create a web page which is compact and yet loaded with all the requisite information. Also these speed up techniques will readily allow your sites to upload faster and hence increase the traffic on your site.

    Posted in CSS, Web Design | Tagged: , , | Leave a Comment »