CSS syntax and commands

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
View Poll Results: How many new languages and such do you regularly pick up from scratch?
Zero; I'm more of a specialist 0 0%
One; I like to keep a bit of excitement. 1 25.00%
Two or more; I plan to take over the world. 3 75.00%
Why are you asking such crazy questions? 0 0%
Voters: 4. You may not vote on this poll

Reply

Join Date: Sep 2006
Posts: 234
Reputation: FireSBurnsmuP is an unknown quantity at this point 
Solved Threads: 1
FireSBurnsmuP's Avatar
FireSBurnsmuP FireSBurnsmuP is offline Offline
Posting Whiz in Training

CSS syntax and commands

 
0
  #1
Oct 17th, 2006
Alright, I just started trying to do some CSS (I know, I have too much time on my hands) in order to make my own theme for firefox, so it matches my windows theme a little better.

However, I really don't know what CSS is, what the general syntax is, and would love a decent list of regularly-used commands. So, could you guys help me?

(more specific questions, cause we all like it better that way XD)
What is CSS and what is it most commonly used for?
How does the general syntax work? Equivalent expressions in HTML and C++ and BASIC work fine for me.
Could I get a short list of commonly-used commands, and their regular syntax?

Thanks a ton, everyone!
Damn computer! It ate everything!
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 1,311
Reputation: vishesh is on a distinguished road 
Solved Threads: 35
vishesh's Avatar
vishesh vishesh is offline Offline
Nearly a Posting Virtuoso

Re: CSS syntax and commands

 
0
  #2
Oct 17th, 2006
CSS which stand for cascading style sheets is used as an extension to HTML. These generally defines how to display the html tags, i mean to say its background color, foreground color, dimensions, postions etc...
For the most it prerequisite for building a good site, since it offers so many features and you cant create a good attracting page just using HTML(which is a foundation for building page).

i hope and assume that u r clear with ID's, CLASS's, ELEMENT's and ATTRIBUTE's.

you basic syntax is

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. element
  2. {
  3. statemen 1;
  4. statement 2;
  5. -----
  6. --------------
  7. statement n;
  8. }
or
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. .class
  2. {
  3. statemen 1;
  4. statement 2;
  5. -----
  6. --------------
  7. statement n;
  8. }
or
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. #id
  2. {
  3. statemen 1;
  4. statement 2;
  5. -----
  6. --------------
  7. statement n;
  8. }
or mix em all together
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. element.class
  2. {
  3. statemen 1;
  4. statement 2;
  5. -----
  6. --------------
  7. statement n;
  8. }
  9.  
  10. element #id
  11. {
  12. statemen 1;
  13. statement 2;
  14. -----
  15. --------------
  16. statement n;
  17. }

and if you want equivalent expressions for C++ , HTML or whatever, i can't help you since u cant compare a stylesheet eith c++. however there are certain thing in CSS which could be done through HTML also such as font-family/font-size/color etc...

some commonly used CSS properties are
margin, padding, display, background, background-image, color, font-family, font-size, border, text-decoration etc... infact every css property is important and helpful .

you can go to http://w3schools.com/css/default.asp for a good CSS tutorial.

vishesh
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 4
Reputation: SallyAnneG is an unknown quantity at this point 
Solved Threads: 0
SallyAnneG SallyAnneG is offline Offline
Newbie Poster

Re: CSS syntax and commands

 
0
  #3
Oct 25th, 2006
Hi

Not sure if you have sorted this out yet, but thought I would drop you a line in case you are still in need of info on CSS.

In the first instance I would go to the following site www.w3.org and click the link to CSS in the column on the left hand side. You should find all you need to know here.

CSS is a very powerful way to control and maintain the appearance of your website. It is intended to separate the design/layout/appearance of the pages from the content. That is, use html to enter content and use (preferably external) style sheets to manipulate the colour, size, positions, etc. This way, if you suddenly decide to change the colour of all the title texts on all of you web pages, you can do this with one single alteration to a style sheet, rather than multiple (not to mention laborious) changes to each web page.

For example if in your style sheet you set up the following:

p.title
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 4
Reputation: SallyAnneG is an unknown quantity at this point 
Solved Threads: 0
SallyAnneG SallyAnneG is offline Offline
Newbie Poster

Re: CSS syntax and commands

 
0
  #4
Oct 25th, 2006
sorry ... accidentally posted before completing all the example. If you want me to finish, just let me know.

NB. One other point. Be aware that you can link more than one external css sheet to a given web page, that way to simplify maintenance, if certain colours, layouts, etc are specific to one or two pages but not all, you can keep this information in its own style sheet and link more than one style sheet to the page. Hope this helps.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 18
Reputation: josh06 is an unknown quantity at this point 
Solved Threads: 0
josh06's Avatar
josh06 josh06 is offline Offline
Newbie Poster

Re: CSS syntax and commands

 
0
  #5
Oct 26th, 2006
it is a very, very easy language I started learning it yesterday for 3 hours and I am already used to it.
Say you wanted to make all <P> tags a red colour, arial font and size 4 you would enter this in the head . . .


<HEAD><STYLE TYPE="CSS">
P
{
text-size: 4;
color: red;
font-family: arial;
}
</STYLE></HEAD>
it is fairly simple, you then do this in the html body<P>Hello this will be red, arial size 4 text</P> hope i helped!!
Last edited by josh06; Oct 26th, 2006 at 9:14 am. Reason: mistake in wriing
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 234
Reputation: FireSBurnsmuP is an unknown quantity at this point 
Solved Threads: 1
FireSBurnsmuP's Avatar
FireSBurnsmuP FireSBurnsmuP is offline Offline
Posting Whiz in Training

Re: CSS syntax and commands

 
0
  #6
Oct 26th, 2006
oh, ok, cool, thanks, everyone. It does seem almost as simple as html; maybe I'll get further into it one of these days...
Damn computer! It ate everything!
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 18
Reputation: josh06 is an unknown quantity at this point 
Solved Threads: 0
josh06's Avatar
josh06 josh06 is offline Offline
Newbie Poster

Re: CSS syntax and commands

 
0
  #7
Oct 27th, 2006
i hope you do
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: CSS syntax and commands

 
0
  #8
Oct 27th, 2006
CSS is not a programming language. It is a declarative language for defining styles. It has no variables, conditionals, loops, logic, or commands. If you want to "program CSS", what you need to learn is JavaScript. JavaScript is a scripting language for manipulating the browser Document Object Model, which includes assigning declared styles (CSS) to document elements (HTML).
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC