Page 96 - DCAP408_WEB_PROGRAMMING
P. 96

Web Programming




                    Notes


                                     Notes  All templates are based on w3c.org technologies and standards  that make your
                                     website much more user-friendly.

                                   4.2 How does CSS Work?

                                   In this lesson, you will learn how to make your first style sheet. You will get to know about the
                                   basic CSS model and which codes are necessary to use CSS in an HTML document. Many of the
                                   properties used in Cascading Style Sheets (CSS) are similar to those of HTML. Thus, if you are
                                   used to use HTML for the layout, you will most likely recognize many of the codes. Let us look
                                   at a concrete example.
                                   The basic CSS syntax:
                                   Let’s say we want a nice red color as the background of a webpage:

                                   Using HTML, we could have done it like this:
                                          <body  bgcolor=”#FF0000">
                                   With CSS the same result can be achieved like this:
                                          body  {background-color:  #FF0000;}




                                     Notes  As you will note, the codes are more or less identical for HTML and CSS. The above
                                     example also shows you the fundamental CSS model.

                                   Self Assessment

                                   Fill in the blanks:
                                   1.  The  ……………….....    is  primarily  tested  on  multiple  platforms  to  ensure  better
                                       requirements  compliance.
                                   2.  ………………..... are the easiest way to provide a default font styling for HTML.

                                   3.  Many of the properties used in ………………..... are similar to those of HTML.

                                   4.3 CSS Declaration

                                   A CSS declaration represents the effect to be applied to the element(s) and it consists of two more
                                   parts — a property and a value. The property is that aspect of an element’s presentation that is being
                                   modified, such as its color, its width, or its placement on the page. Dozens of properties are available
                                   in the CSS language, and you’ll become familiar with many of them in the pages of this book.
                                   The declaration block, denoted by the curly braces (“{“,”’}”). Within this block are zero or more
                                   declarations. While defining multiple declarations, it must be separated by a semicolon (“;”).
                                   Each declaration consists of a property and a value, separated by a colon (“:”). Properties are
                                   identifiers,  such  as  font-size, background-color,  etc. The  values permitted  depend  on  the
                                   individual property.



                                     Did u know?  What is the use of whitespace in CSS declarations?
                                     Whitespace may be used around any of these tokens, so you can format them for easy
                                     reading. You can also insert comments anywhere whitespace is permitted.


          90                                LOVELY PROFESSIONAL UNIVERSITY
   91   92   93   94   95   96   97   98   99   100   101