Jump to content
xisto Community
Sign in to follow this  
fahim

What Is Css? all about CSS.

Recommended Posts

Hey i didn't know what CSS really was but this helped me, So if it can help me i thought i should take some benefit from it too.

 

 

What is CSS?

 

* CSS stands for Cascading Style Sheets

* Styles define how to display HTML elements

* Styles are normally stored in Style Sheets

* Styles were added to HTML 4.0 to solve a problem

* External Style Sheets can save you a lot of work

* External Style Sheets are stored in CSS files

* Multiple style definitions will cascade into one

 

Edited by ZapooH (see edit history)

Share this post


Link to post
Share on other sites

Copied from W3Schools CSS Intro. Please quote text and also add your own information, opinions or anything relevant if you are copying text from other sources.

Personally, I think that CSS does save a lot of work, the more (X)HTML pages you have, the more work it saves if you are applying the same style sheet to all the pages.

Styles were added to HTML 4.0 to solve a problem. Yes, they deprecated <font>, <center>, <u>, <s> as well as a few other tags because they could be replaced by CSS. Also, attributes such as align, bgcolor, hspace and vspace were deprecated too.

CSS is much more powerful than the deprecated stuff though. Even when applied inline with the style attribute, it can do many more things with a whole lot of properties other than font or text effects. Combined with pseudo-classes and attribute selectors when used in an external (or internal) style sheet and it has plenty of power.

CSS stands for Cascading style sheets because as mentioned above, styles will cascade into one. What this means is that some styles will be more important, and will be applied, if you declare them both (or 3 times). If there is a style attribute, it always goes with that. If not, it goes with the one in the internal style sheet. If it isn't there, the one in the external style sheet will be used.

There is much to learn about CSS, but it can be a pain to develop if you are aiming for compatibility with Internet Explorer 5.5 or even 6.

Share this post


Link to post
Share on other sites

Learning HTML back in 1997 abouts, I was personally annoyed when CSS hit the scene. It looked like a cheapened down version of what I was already doing in java script: I could make JS functions to take over much of my formatting, mainly with TABLEs where I could write script to colour each row alternating colours, or document.write all those <TR><TD>blah blah blah</TD></TR> bits. I would write a JavaScript function called "newrow(xx,yy,zz)" which would write the HTML <TR><TD>xx</TD><TD>yy</TD><TD>zz</TD></TR> for me.

...I thought I was clever with my own scripts custom-writing big pages and I begrudged CSS when it appeared on the scene. I didn't have a problem coding in raw <FONT> style tags and I was especially annoyed at the confusion of changing mu prefered tags like <B> and <I> to text wasting versions like <strong> and <em>.

Unfortunately for me though, CSS has become the norm. Nowdays if you write JavaScript, the end viewer is likely to see a warning asking if they want to allow the script to run. Usually virus-wary users click "no" and any JavaScript menus etc that I was so proud of before would no longer even show. Time has moved on.

 

So what is the point of CSS then?

On one hand it's to make pages work better with dynamic effects like mouseover text etc. It's not as hard core to make a mouseover effect in CSS than I used to do with a JavaScript variation. All you do now is add the attribute to your tag.

CSS is supposed to be browser-friendly, in that all browsers should see the same looking page. (Just prior to its introduction, there were big differences in what browsers would do for some of the same tags. Sometimes I used to have to write JavaScript to figure out what browser someone was using and spit out different code just for them!)

Perhaps the most commonly used factor in CSS is in the way you can have a separate stylesheet to determine what the base fonts etc are going to look like on your page. If every page of your site refers to the same sheet, then you can change the heading colour (for example) in the stylesheet and every page on your site instantly matches your template style. On a large site this is pure magic! No more wasting days going through every page and manually changing the font styles for each one.

But now, CSS has grown much bigger in time and can completely transform things in terms of layout...

 

...and this is where I would really look silly if I was still trying to code everything in JavaScript...

 

Check out http://www.csszengarden.com/

...it's an example of a page where you get to see the same page, but given a different CSS stylesheet each time. The page looks entirely different!

 

Another one is http://www.strangebanana.com/generator.aspx

...every time you hit "refresh" on your browser, they load up a different (randomly created) CSS stylesheet. It's the same page but it looks so different!

 

Imagine if they'd hired web developers in each time they wanted to freshen up the theme of their page, say, to customise it for each day of the week?

 

CSS is amazing.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.