SlideShare uma empresa Scribd logo
1 de 20
Baixar para ler offline
Programming and Development Tools                            Web Programming




                                                              UNIT


                                                             2.12
Web Programming
Style Sheets




  OBJECTIVES
 This unit helps you to use Cascading Style Sheets in your Web pages.
 At the end of this unit, you will be able to
               List the advantages of using Style Sheets.
               Add External Style Sheet to your Web pages.
               Add Internal Style Sheet to your Web pages.
               Add Inline Style Sheet to your Web pages.




Benchmark standard
           Design Web pages with uniformity using Style Sheets.




Style Sheets                                                         2.12-1
Programming and Development Tools                                Web Programming




Let us Revise!

 1. List the controls that can be added to a form.
 2. State the difference between text field and text area.
 3. Mention the use of Action and Method attributes of <FORM> tag.
 4. State the difference between radio button and check box.
 5. Which tag is used to add drop-down list box to a form.



 Introduction
 Do you want to change the default values of the attributes of a tag? You can
 change it to your need using CSS. CSS stands for Cascading Style Sheets.
 The tags in HTML have their own function by default. These tags can be
 enhanced by using Style Sheet. A Style Sheet contains a set of instructions
 that modifies the values of the attributes of a tag. For example, the tag <H1>
 displays the text in black colour. The colour of the text can be changed for
 <H1> tag using Style Sheets.
 The advantages of using Style Sheets are:
            An attribute’s value of a tag can be specified once and the tag can
            be used anywhere in the file without specifying the attribute again
            and again. It is like changing the default value of an attribute.
            If you want to modify any attribute, it is enough if you change the
            value in the Style where it is defined instead of changing the values
            wherever the tag is used.


         Note

 CSS, Style Sheet and Cascading Style Sheet all mean the same.


 Styles can be defined in 3 ways using:
            External Style Sheets,
            Internal Style Sheets and
            Inline Style Sheet

 2.12.1 External Style Sheets
 In the External Style Sheets, the tags that are necessary to create styles are
 saved in a file with extension .css. This file is linked to the HTML file by using

 Style Sheets                                                              2.12-2
Programming and Development Tools                              Web Programming


the <LINK> tag in the HTML file. The <LINK> tag has HREF attribute to
which the URL of the style sheet file (.css) is assigned. The <LINK> tag is
placed inside the <HEAD> tag.

     Hands-On!

The following example illustrates the use of External Style Sheets in a
Webpage.
Open the HTML file Ext_CSS.html in Internet Explorer.
The code in Ext_CSS.html file is given below:
<HTML>
   <HEAD>
       <TITLE> CSS </TITLE>
       <link REL="StyleSheet" TYPE="text/css"
               HREF="Style1.css">
   </HEAD>
   <BODY><FONT Size=5>
   <H1> WORLD POPULATION : 2003 </H1>
   The first five most populous countries are: <BR>
   <OL>
         <LI> China
         <LI> India
         <LI> United States
         <LI> Indonesia
         <LI> Brazil
   </OL>
   <TABLE Cellspacing=0 Align="Center">
         <TR Bgcolor="Darkgreen" Height="40"> <TH
                Width="20%"> S.No.<TH Width="40%">Country<TH
                Width="40%"> Population</TR>
         <TR> <TD>1 <TD>China                   <TD>1,286,975,468 </TR>
         <TR> <TD>2 <TD>India                   <TD>1,049,700,118 </TR>
         <TR> <TD>3 <TD>United States<TD>290,342,554                      </TR>
         <TR> <TD>4 <TD>Indonesia               <TD>234,893,453           </TR>
         <TR> <TD>5 <TD>Brazil                  <TD>182,032,604           <TR>
   </TABLE>
   </FONT>
   </BODY>

Style Sheets                                                              2.12-3
Programming and Development Tools                          Web Programming


</HTML>
                             Code Sample 2.12.1
The Web page shown in Figure 2.12.1 is displayed in the browser window.




           Figure 2.12.1: A Web Page Using External Style Sheet


In the code shown in Code Sample 2.12.1, the tag <link Rel="StyleSheet"
Type="text/css" Href="Style1.css"> creates a link to the Style1.css file.
The following are the tags specified in Style1.css file:
   H1      {Text-Align:Center;color:Firebrick}
   BODY {Background:LightYellow}
   TABLE{Border:outset 5pt;Background-
Image:URL("Picture2.jpg");Width:60%;Color:yellow;Font-
size=20}
   TD      {Text-Align: Center; Height: 40}
   OL      {Color:Firebrick}
                             Code Sample 2.12.2

The following is the syntax used to modify the attributes of a tag:
   Tag_Name {Attribute1: Value; Attribute2: Value; …………..}



Style Sheets                                                        2.12-4
Programming and Development Tools                                             Web Programming


It is clear from the Code Sample 2.12.2 that <H1>, <BODY>, <TABLE>,
<TD> and <OL> are the tags that are modified. The following are the
changes made:
The Color attribute is set to Firebrick and the text is centered for <H1> tag.
The Background Color is set to Lightyellow for the <BODY> tag.
The border width is set to 5, Picture2.jpg is set as the background image, table
width is set to 60% of the width of the browser window, the colour of the text is
set to Yellow and the size of the text is set to 20 for the <TABLE> tag.
The Height of a cell is set to 40 and the text is centered for <TD> tag.
The colour is set to Firebrick for <OL> tag.
When these modified tags are used in your HTML file, the tags take the
values of the attributes mentioned in the .css file unless the attributes are
specified. For example, the heading of the Web page shown in Figure 2.12.1
is centered instead of left alignment.


         Note

External Style Sheet is also called as Linked Style Sheet

        Self-Check Exercise 2.12.1

Say true or false:
1.      In External Style Sheets, styles are defined in a separate file with extension .ccs.
2.      The 3 ways of defining styles are using External Style Sheets, Internal Style Sheets
        and Inline Styles.
3.      The <LINK> tag is placed inside the <HEAD> tag.



        Lab Exercise

Lab Exercise 1: Open D12_1.html in Internet Explorer. The following code will be present in
D12_1.html.


<HTML>
<HEAD>
    <TITLE> WELCOME TO ZAI SUPER MARKET </TITLE>
    <LINK REL="STYLESHEET" TYPE="TEXT/CSS"
    HREF="D12_1.CSS">
    <H5 ALIGN="CENTER">
          WELCOME TO ZAI SUPER MARKET
    </H5>
    <H1 ALIGN="CENTER">

Style Sheets                                                                              2.12-5
Programming and Development Tools                     Web Programming


                       No.3 Plaza Dhamas, &nbsp;
                       Sri Hartamaas <BR>
                       Kuala Lumpur <BR><BR>
     </H1>
</HEAD>
<BODY>
<CENTER>
     <TABLE BORDER=1>
           <TR>
                 <TH WIDTH=10%>S.NO </TH>
                 <TH WIDTH=50%> PRODUCT NAME</TH>
                 <TH WIDTH=20%>QTY</TH>
                 <TH WIDTH=15%> PRICE </TH>
           </TR>
           <TR>
                 <TD ALIGN="CENTER">101 </TD>
                 <TD> Coke</TD>
                 <TD> 250 ML</TD>
                 <TD> 1.70 RM</TD>
           </TR>

               <TR>
                       <TD ALIGN="CENTER">102 </TD>
                       <TD> Pepsi</TD>
                       <TD> 250 ML</TD>
                       <TD> 1.50 RM</TD>
               </TR>

               <TR>
                       <TD ALIGN="CENTER">102 </TD>
                       <TD>Sprit</TD>
                       <TD> 250 ML</TD>
                       <TD> 1.50 RM</TD>
               </TR>

               <TR>
                       <TD ALIGN="CENTER">102 </TD>
                       <TD> 100 Plus</TD>
                       <TD> 250 ML</TD>
                       <TD> 1.00 RM</TD>
               </TR>

               <TR>
                       <TD ALIGN="CENTER">102 </TD>
                       <TD> Milo </TD>
                       <TD> 150 ML</TD>
                       <TD> 1.30 RM</TD>
               </TR>

               <TR>

Style Sheets                                                  2.12-6
Programming and Development Tools                                                Web Programming


                         <TD ALIGN="CENTER">102 </TD>
                         <TD> Lychee </TD>
                         <TD> 150 ML</TD>
                         <TD> 1.20 RM</TD>
          </TR>
     </TABLE>
</CENTER>
</BODY>
</HTML>

1.      Locate the tag which is used to call the external style sheet file into html file.
2.      Identify the attribute which is used to define the relationship between the linked file and
        the HTML file.
3.      Name the attribute which is used to specify the type of the file.


Lab Exercise 2: Open D12_1.HTML in Notepad.


1.      View the source code in the Notepad.
2.      Change the background and text colour as shown in the following Figure 2.12.2.




                   Figure 2.12.2: Welcome to ZAI Super Market


Lab Exercise 3: Create an external style sheet and display the output as given in the following
               Figure 2.12.3.


Style Sheets                                                                                 2.12-7
Programming and Development Tools                                 Web Programming




                       Figure 2.12.3: Wonders of the World

2.12.2 Internal Style Sheets
In the Internal Style Sheets, the tags that are necessary to create styles are
placed inside the <STYLE> tag. The <STYLE> tag is placed inside the
<HEAD> tag of the HTML file.

         Note

Internal Style Sheets are also called as Embedded Style Sheets.

     Hands-On!


The following example illustrates the use of Internal Style Sheets in a
Webpage.
Open the HTML file Int_CSS.html in Internet Explorer.
The code in Int_CSS.html file is given below:


<HTML>
   <HEAD>
       <TITLE> CSS </TITLE>


Style Sheets                                                              2.12-8
Programming and Development Tools                      Web Programming


       <STYLE Type="text/css">
           H1    {Text-Align:Center;color:Firebrick}
           BODY {Background:LightYellow}
          TABLE{Border:outset 5pt;
                Background-Image:URL("Picture2.jpg");
                Width:60%;Color:yellow;Font-size=20}
           TD    {Text-Align:Center;Height:40}
           OL    {Color:Firebrick}
       </STYLE>
   </HEAD>
   <BODY><FONT Size=5>
   <H1> WORLD POPULATION : 2003 </H1>
   The first five most populous countries are: <BR>
   <OL>
         <LI> China
         <LI> India
         <LI> United States
         <LI> Indonesia
         <LI> Brazil
   </OL>
   <TABLE Cellspacing=0 Align="Center">
         <TR Bgcolor="Darkgreen" Height="40"> <TH
           Width="20%"> S.No.<TH Width="40%">Country<TH
           Width="40%"> Population</TR>
         <TR> <TD>1 <TD>China               <TD>1,286,975,468 </TR>
         <TR> <TD>2 <TD>India               <TD>1,049,700,118 </TR>
         <TR> <TD>3 <TD>United States<TD>290,342,554          </TR>
         <TR> <TD>4 <TD>Indonesia           <TD>234,893,453   </TR>
         <TR> <TD>5 <TD>Brazil              <TD>182,032,604   <TR>
   </TABLE>
</FONT>
   </BODY>
</HTML>
                             Code Sample 2.12.3
The same Web page shown in Figure 2.12.1 is displayed in the browser
window.

Style Sheets                                                   2.12-9
Programming and Development Tools                                           Web Programming


In External Style Sheets, you created a file with extension .css. This file
contains all the tags that were used to define the styles. In Internal Style
Sheet, all the tags that are required to define the styles are placed inside the
<STYLE> and </STYLE> tags which in turn is placed inside the <HEAD>
and </HEAD> tags. The difference between External Style Sheet and
Internal Style Sheet is that the former can be used by any HTML file whereas
the latter can be used only by the HTML file where it is defined.


         Note

No separate file is created for defining styles in Internal Style Sheets.


2.12.3 Inline Style Sheets
In the Inline Styles, the styles are inserted directly into the tags by assigning
styles to the Style attribute of respective tags.

      Hands-On!


The following example illustrates the use of Inline Styles in a Webpage.
Open the HTML file Inl_CSS.html in Internet Explorer.
The code in Inl_CSS.html file is given below:
<HTML>
     <HEAD>
          <TITLE> CSS </TITLE>
     </HEAD>
     <BODY Style=Background:LightYellow><FONT Size=5>
          <H1 Style="Text-Align:Center;color:Firebrick">
              WORLD POPULATION : 2003 </H1>
          The first five most populous countries are: <BR>
          <OL Style="Color:Firebrick">
                <LI> China
                <LI> India
                <LI> United States
                <LI> Indonesia
                <LI> Brazil
          </OL>
          <TABLE Align="Center" Cellspacing="0"
                 Style="Border:outset 5pt;

Style Sheets                                                                        2.12-10
Programming and Development Tools                     Web Programming


                  Width:60%;Color:yellow;Font-size=20;
                  Background:URL(Picture2.jpg)">
               <TR Bgcolor="Darkgreen" Height="40">
                 <TH Width="20%"> S.No.
                 <TH Width="40%">Country
                 <TH Width="40%"> Population
               </TR>
               <TR>
                  <TD Style="Text-Align:Center;Height:40">1
                  <TD>China
                  <TD>1,286,975,468
                </TR>
                <TR>
                  <TD Style="Text-Align:Center;Height:40">2
                  <TD>India
                  <TD>1,049,700,118
                </TR>
                <TR>
                   <TD Style="Text-Align:Center;Height:40">3
                   <TD>United States
                   <TD>290,342,554
                </TR>
                <TR>
                   <TD Style="Text-Align:Center;Height:40">4
                   <TD>Indonesia
                   <TD>234,893,453
                 </TR>
                 <TR>
                       <TD Style="Text-Align:Center;Height:40">5
                       <TD>Brazil
                       <TD>182,032,604
                 </TR>
         </TABLE>
    </FONT>
    </BODY>

Style Sheets                                                  2.12-11
Programming and Development Tools                                           Web Programming


</HTML>
                                  Code Sample 2.12.3
The same Web page shown in Figure 2.12.1 is displayed in the browser
window.
For example, the following code in Code Sample 2.12.3, sets the background
colour of the Web page to Light yellow using Inline Styles.
<BODY Style=Background:LightYellow>
Here, the background of the Web page is set to Lightyellow by assigning the
value to the Style attribute of the <BODY> tag.


Order of Precedence
If more than one type of Style Sheet is specified in a HTML file, the browser
follows an order to select the Style Sheet to be used. The following is the
order of precedence followed by a browser:
1.      Inline Style Sheet
2.      Internal or Embedded Style Sheet
3.      External or Linked Style Sheet
4.      Default style used by the browser (If the Style is not specified).
If all the 3 Style Sheets are specified, the Internal Style Sheet adopts the
styles mentioned in the External Style Sheet that are not mentioned in the
Internal Style Sheet. The Inline Style Sheet adopts the styles mentioned in the
Internal Style Sheet that are not mentioned in the Inline Style Sheet. Hence, it
is called as Cascading Style Sheet.

        Lab Exercise

Lab Exercise 4: Create an external style sheet and display the output as given in the following
                 Figure 2.12.4.




Style Sheets                                                                           2.12-12
Programming and Development Tools                                            Web Programming




              Figure 2.12.4: A Web Page Using External Style Sheet


         Self-Check Exercise 2.12.2

Fill in the blanks:
1.    The tags that are required to define the styles using Internal Style Sheet are placed
      inside the _____ and _____ tags.
2.     ______ attribute is used to specify Inline Styles.
3.     ______ Style Sheet has the highest priority.


       Activity 2.12.1

1. Create a Web page that explains Cascading Style Sheets as shown in
Figure 2.12.5.
2. Save the HTML file as Activity2.12.1.html.
3. The content of the same page is continued in Figure 2.12.6.




Style Sheets                                                                            2.12-13
Programming and Development Tools                          Web Programming




                Figure 2.12.5: A Web page Explaining CSS




     Figure 2.12.6: Continuation of Web page shown in Figure 2.12.5

Style Sheets                                                       2.12-14
Programming and Development Tools                             Web Programming




     Activity 2.12.2

As explained earlier, the Web pages created in the Activities of all the units
from 3 to 12 will lead to the creation of a Web Site. The Web pages in all the
Activities should be linked together. Do the following to create the home page
for this Web site.
1. Create a Web page as shown in Figure 2.12.7 whose continuation is given
in Figure 2.12.8. The files to be linked and their location are given in Table
2.12.1.
2. Save the HTML file as Index.html in C:HTML folder.




               Figure 2.12.7: A Web page Containing Links




Style Sheets                                                           2.12-15
Programming and Development Tools                               Web Programming




     Figure 2.12.8: Continuation of Web page shown in Figure 2.12.7


     Activity 2.12.3

The home page shown in Figure 2.12.9 contains two vertical frames. Load the
file Index.html located at C:HTML folder in the left frame and Activity3.html
located at C:HTMLUnit 7Activity folder in the right frame. When a link in the
left frame is clicked, the corresponding page should be opened in the right
frame. The link, the file to be linked and its location is given in Table 2.12.1.
    Link in the left         File to be linked              Location
          frame
  About the Internet        Activity3.html           C:HTMLUnit 7Activity
  Basics of HTML            Activity5.html           C:HTMLUnit 3Activity
  Adding Headings           Activity1.html           C:HTMLUnit 3Activity
  Inserting Line Breaks     Activity2.html           C:HTMLUnit 3Activity
  and Paragraphs
  Drawing Horizontal        Activity3.html           C:HTMLUnit 3Activity
  Rule
  Scrolling the Text        Activity4.html           C:HTMLUnit 3Activity
  Making the Text Bold,     Activity1.html           C:HTMLUnit 4Activity


Style Sheets                                                             2.12-16
Programming and Development Tools                                 Web Programming


  Italic and Underlined
  Changing the Size of        Activity2.html          C:HTMLUnit 4Activity
  the Text
  Positioning and Striking    Activity3.html          C:HTMLUnit 4Activity
  the Text
  Ordered List                Activity1.html          C:HTMLUnit 5Activity
  Unordered List              Activity2.html          C:HTMLUnit 5Activity
  Definition List             Activity3.html          C:HTMLUnit 5Activity
  Adding Hyperlinks           Activity1.html          C:HTMLUnit 6Activity
  Inserting Images            Activity1.html          C:HTMLUnit 7Activity
  Inserting Music, Movie      Activity1.html          C:HTMLUnit 8Activity
  and Animation
  Adding Tables               Activity1.html          C:HTMLUnit 9Activity
  Creating Frames             Activity6.html         C:HTMLUnit 10Activity
  Adding Forms and            Activity2.html         C:HTMLUnit 11Activity
  Controls
  Cascading Style             Activity1.html         C:HTMLUnit 12Activity
  Sheets
                    Table 2.12.1: Details of files to be linked
1. Create a Web page shown in Figure 2.12.9. Save the HTML file as
Main.html in C:HTML folder.
2. Save the HTML file as Main.html in C:HTML folder.
3. All the Web pages of a Web site should have the same appearance. So
create an external style sheet file Style.css in C:HTML folder. The commands
in Style.css is shown below:
H1     {Text-Align:Center;Color:Firebrick}
H2     {color:Firebrick}
H3     {color:Firebrick}
BODY {Background:Lightyellow;Font-Size:14pt}
FONT {Font-Size:14pt}
4. Add the following code inside the <HEAD> tag in all the activity files
created.
<LINK Rel="Stylesheet" Href="C:HTMLStyle.css">
5. Open the Main.html folder in Internet Explorer and browse the Web site
created.




Style Sheets                                                              2.12-17
Programming and Development Tools                                    Web Programming




                            Figure 2.12.9: Home page


       Technical Terminologies

External Style Sheet            - A Style Sheet placed in an external file with
                                  extension .css
Internal Style Sheet            - A Style Sheet placed internally in the same
                                  HTML file.
Inline Style Sheet              - Styles defined inside the tag using Style attribute.
Cascading Style Sheet           - The Style Sheet having higher precedence
                                  adopts the styles mentioned in a Style Sheet of
                                  lower precedence. This is called as Cascading
                                  Style Sheet.

Summary
In this unit, you learnt that
           CSS stands for Cascading Style Sheets.
           The 3 types of Style Sheets are Internal Style Sheet, External Style
           Sheet and Inline Style Sheet.
            In the External Style Sheets, the tags that are necessary to create
           styles are saved in a file with extension .css.
           In the Internal Style Sheets, the tags that are necessary to create
           styles are placed inside the <STYLE> tag.

Style Sheets                                                                  2.12-18
Programming and Development Tools                                Web Programming


            In the Inline Styles, the values that are necessary to create styles
            are assigned to the Style attribute of respective tags.
            Inline styles hold the highest priority among the Style Sheets.



Assignment

 I. Answer the following questions:
 1. List any 2 advantages of using Style Sheets.
 2. Name the three Style Sheets.
 3. Create a .css file to create an External Style Sheet that modifies the
 attributes of <TABLE> tag.
 4. Write the <STYLE> tag to convert the External Style Sheet mentioned in
 3rd question to Internal Style Sheet.
 5. Write the <TABLE> tag to convert the Internal Style Sheet mentioned in 4th
 question to Inline Style Sheet.




 Style Sheets                                                              2.12-19
Programming and Development Tools                             Web Programming



Criterion Referenced Test
Instruction: Students must evaluate themselves to attain the list of
             competencies to be achieved.

Name:
Subject:       Programming and Development Tools
Unit:          Style Sheets

Please tick [ √ ] the appropriate box when you have achieved the respective
competency.

Date                                    Style Sheets
                 C1   C2    C3




Comment



Competency codes:

C1 = Create a Web page using External Style Sheet.
C2 = Create a Web page using Internal Style Sheet.
C3 = Create a Web page using Inline Style Sheet.




Style Sheets                                                          2.12-20

Mais conteúdo relacionado

Destaque

Siosgustanlosbichejos
SiosgustanlosbichejosSiosgustanlosbichejos
Siosgustanlosbichejosguestabfc2d
 
Digital literacy and competences as essential life skills
Digital literacy and competences as essential life skillsDigital literacy and competences as essential life skills
Digital literacy and competences as essential life skillsDeborahJane
 
The changing landscape, a personal view for OER Wales
The changing landscape, a personal view for OER WalesThe changing landscape, a personal view for OER Wales
The changing landscape, a personal view for OER WalesLis Parcell
 
Tamgun
TamgunTamgun
Tamgunanttab
 
A Sourcing and Recruiting Method that Works
A Sourcing and Recruiting Method that WorksA Sourcing and Recruiting Method that Works
A Sourcing and Recruiting Method that WorksAndrea Tanzi
 
Frost sullivan windows case study final 12.20.10
Frost sullivan windows case study final 12.20.10Frost sullivan windows case study final 12.20.10
Frost sullivan windows case study final 12.20.10sbendt
 
Building advocacy and trust: social media for engagement
Building advocacy and trust: social media for engagementBuilding advocacy and trust: social media for engagement
Building advocacy and trust: social media for engagementLis Parcell
 
ReMashed - An Usability Study of a Recommender System for Mash-Ups for Learn...
ReMashed - An Usability Study of a Recommender System for Mash-Ups for Learn...ReMashed - An Usability Study of a Recommender System for Mash-Ups for Learn...
ReMashed - An Usability Study of a Recommender System for Mash-Ups for Learn...Hendrik Drachsler
 
Using Simulations to Evaluated the Effects of Recommender Systems for Learner...
Using Simulations to Evaluated the Effects of Recommender Systems for Learner...Using Simulations to Evaluated the Effects of Recommender Systems for Learner...
Using Simulations to Evaluated the Effects of Recommender Systems for Learner...Hendrik Drachsler
 
3rd Workshop on Social Information Retrieval for Technology-Enhanced Learnin...
3rd Workshop onSocial  Information Retrieval for Technology-Enhanced Learnin...3rd Workshop onSocial  Information Retrieval for Technology-Enhanced Learnin...
3rd Workshop on Social Information Retrieval for Technology-Enhanced Learnin...Hendrik Drachsler
 
Unenouvelleplageaujapon3
Unenouvelleplageaujapon3Unenouvelleplageaujapon3
Unenouvelleplageaujapon3guesta8bc6b
 
Garter Snake
Garter SnakeGarter Snake
Garter SnakeJohn022
 
Birds of a Feather? - Do Participants’ Hierarchical Positions activate Homoph...
Birds of a Feather? - Do Participants’ Hierarchical Positions activate Homoph...Birds of a Feather? - Do Participants’ Hierarchical Positions activate Homoph...
Birds of a Feather? - Do Participants’ Hierarchical Positions activate Homoph...Martin Rehm
 
UNIT 2.2 Web Programming HTML Basics - Benchmark standard
UNIT 2.2 Web Programming HTML Basics - Benchmark standardUNIT 2.2 Web Programming HTML Basics - Benchmark standard
UNIT 2.2 Web Programming HTML Basics - Benchmark standardIntan Jameel
 
Future of Serverless from ServerlessConf London October 2016
Future of Serverless from ServerlessConf London October 2016Future of Serverless from ServerlessConf London October 2016
Future of Serverless from ServerlessConf London October 2016Paul Johnston
 

Destaque (20)

Siosgustanlosbichejos
SiosgustanlosbichejosSiosgustanlosbichejos
Siosgustanlosbichejos
 
Digital literacy and competences as essential life skills
Digital literacy and competences as essential life skillsDigital literacy and competences as essential life skills
Digital literacy and competences as essential life skills
 
The changing landscape, a personal view for OER Wales
The changing landscape, a personal view for OER WalesThe changing landscape, a personal view for OER Wales
The changing landscape, a personal view for OER Wales
 
Tamgun
TamgunTamgun
Tamgun
 
A Sourcing and Recruiting Method that Works
A Sourcing and Recruiting Method that WorksA Sourcing and Recruiting Method that Works
A Sourcing and Recruiting Method that Works
 
Frost sullivan windows case study final 12.20.10
Frost sullivan windows case study final 12.20.10Frost sullivan windows case study final 12.20.10
Frost sullivan windows case study final 12.20.10
 
Building advocacy and trust: social media for engagement
Building advocacy and trust: social media for engagementBuilding advocacy and trust: social media for engagement
Building advocacy and trust: social media for engagement
 
Wine Of Austria
Wine Of AustriaWine Of Austria
Wine Of Austria
 
數位電視
數位電視數位電視
數位電視
 
ReMashed - An Usability Study of a Recommender System for Mash-Ups for Learn...
ReMashed - An Usability Study of a Recommender System for Mash-Ups for Learn...ReMashed - An Usability Study of a Recommender System for Mash-Ups for Learn...
ReMashed - An Usability Study of a Recommender System for Mash-Ups for Learn...
 
Using Simulations to Evaluated the Effects of Recommender Systems for Learner...
Using Simulations to Evaluated the Effects of Recommender Systems for Learner...Using Simulations to Evaluated the Effects of Recommender Systems for Learner...
Using Simulations to Evaluated the Effects of Recommender Systems for Learner...
 
3rd Workshop on Social Information Retrieval for Technology-Enhanced Learnin...
3rd Workshop onSocial  Information Retrieval for Technology-Enhanced Learnin...3rd Workshop onSocial  Information Retrieval for Technology-Enhanced Learnin...
3rd Workshop on Social Information Retrieval for Technology-Enhanced Learnin...
 
Unenouvelleplageaujapon3
Unenouvelleplageaujapon3Unenouvelleplageaujapon3
Unenouvelleplageaujapon3
 
Garter Snake
Garter SnakeGarter Snake
Garter Snake
 
Belgie2
Belgie2Belgie2
Belgie2
 
Birds of a Feather? - Do Participants’ Hierarchical Positions activate Homoph...
Birds of a Feather? - Do Participants’ Hierarchical Positions activate Homoph...Birds of a Feather? - Do Participants’ Hierarchical Positions activate Homoph...
Birds of a Feather? - Do Participants’ Hierarchical Positions activate Homoph...
 
UNIT 2.2 Web Programming HTML Basics - Benchmark standard
UNIT 2.2 Web Programming HTML Basics - Benchmark standardUNIT 2.2 Web Programming HTML Basics - Benchmark standard
UNIT 2.2 Web Programming HTML Basics - Benchmark standard
 
Unit 2.1 Part 2
Unit 2.1 Part 2Unit 2.1 Part 2
Unit 2.1 Part 2
 
Emeklilik Şirketleri
Emeklilik ŞirketleriEmeklilik Şirketleri
Emeklilik Şirketleri
 
Future of Serverless from ServerlessConf London October 2016
Future of Serverless from ServerlessConf London October 2016Future of Serverless from ServerlessConf London October 2016
Future of Serverless from ServerlessConf London October 2016
 

Semelhante a Unit 2.12

Semelhante a Unit 2.12 (20)

HTML [Basic] --by Abdulla-al Baset
HTML [Basic] --by Abdulla-al BasetHTML [Basic] --by Abdulla-al Baset
HTML [Basic] --by Abdulla-al Baset
 
Vijay it 2 year
Vijay it 2 yearVijay it 2 year
Vijay it 2 year
 
Caracteristicas Basicas De Htlm
Caracteristicas Basicas De HtlmCaracteristicas Basicas De Htlm
Caracteristicas Basicas De Htlm
 
Html
HtmlHtml
Html
 
Unit 1-HTML Final.ppt
Unit 1-HTML Final.pptUnit 1-HTML Final.ppt
Unit 1-HTML Final.ppt
 
Unit 2.9 Tables
Unit 2.9 TablesUnit 2.9 Tables
Unit 2.9 Tables
 
Unit 1wt
Unit 1wtUnit 1wt
Unit 1wt
 
Unit 1wt
Unit 1wtUnit 1wt
Unit 1wt
 
Hypertext markup language(html)
Hypertext markup language(html)Hypertext markup language(html)
Hypertext markup language(html)
 
HTML Tutorials
HTML TutorialsHTML Tutorials
HTML Tutorials
 
Html 5
Html 5Html 5
Html 5
 
Html tags describe in bangla
Html tags describe in banglaHtml tags describe in bangla
Html tags describe in bangla
 
Html tag list
Html tag listHtml tag list
Html tag list
 
Css
CssCss
Css
 
Hyper Text Markup Language (HTML)
Hyper Text Markup Language (HTML)Hyper Text Markup Language (HTML)
Hyper Text Markup Language (HTML)
 
Practicals it
Practicals itPracticals it
Practicals it
 
Intodcution to Html
Intodcution to HtmlIntodcution to Html
Intodcution to Html
 
IP - Lecture 6, 7 Chapter-3 (3).ppt
IP - Lecture 6, 7 Chapter-3 (3).pptIP - Lecture 6, 7 Chapter-3 (3).ppt
IP - Lecture 6, 7 Chapter-3 (3).ppt
 
Cascading Style Sheets
Cascading Style SheetsCascading Style Sheets
Cascading Style Sheets
 
Html html html html html html html html html
Html html html html html html html html htmlHtml html html html html html html html html
Html html html html html html html html html
 

Mais de Intan Jameel (20)

1.3 Process and Information Layout
1.3 Process and Information Layout1.3 Process and Information Layout
1.3 Process and Information Layout
 
Unit 2.10 - Frames
Unit 2.10 - FramesUnit 2.10 - Frames
Unit 2.10 - Frames
 
M02 un11 p02
M02 un11 p02M02 un11 p02
M02 un11 p02
 
M02 un10 p02
M02 un10 p02M02 un10 p02
M02 un10 p02
 
M02 un10 p01
M02 un10 p01M02 un10 p01
M02 un10 p01
 
M02 un09 p02
M02 un09 p02M02 un09 p02
M02 un09 p02
 
M02 un09 p01
M02 un09 p01M02 un09 p01
M02 un09 p01
 
M02 un08 p01
M02 un08 p01M02 un08 p01
M02 un08 p01
 
M02 un07 p02
M02 un07 p02M02 un07 p02
M02 un07 p02
 
M02 un07 p01
M02 un07 p01M02 un07 p01
M02 un07 p01
 
M02 un06 p02
M02 un06 p02M02 un06 p02
M02 un06 p02
 
M02 un06 p01
M02 un06 p01M02 un06 p01
M02 un06 p01
 
M02 un05 p02
M02 un05 p02M02 un05 p02
M02 un05 p02
 
M02 un05 p01
M02 un05 p01M02 un05 p01
M02 un05 p01
 
M02 un04 p04
M02 un04 p04M02 un04 p04
M02 un04 p04
 
M02 un04 p03
M02 un04 p03M02 un04 p03
M02 un04 p03
 
M02 un04 p02
M02 un04 p02M02 un04 p02
M02 un04 p02
 
M02 un04 p01
M02 un04 p01M02 un04 p01
M02 un04 p01
 
M02 un12 p01
M02 un12 p01M02 un12 p01
M02 un12 p01
 
M02 un11 p01
M02 un11 p01M02 un11 p01
M02 un11 p01
 

Último

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 

Último (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 

Unit 2.12

  • 1. Programming and Development Tools Web Programming UNIT 2.12 Web Programming Style Sheets OBJECTIVES This unit helps you to use Cascading Style Sheets in your Web pages. At the end of this unit, you will be able to List the advantages of using Style Sheets. Add External Style Sheet to your Web pages. Add Internal Style Sheet to your Web pages. Add Inline Style Sheet to your Web pages. Benchmark standard Design Web pages with uniformity using Style Sheets. Style Sheets 2.12-1
  • 2. Programming and Development Tools Web Programming Let us Revise! 1. List the controls that can be added to a form. 2. State the difference between text field and text area. 3. Mention the use of Action and Method attributes of <FORM> tag. 4. State the difference between radio button and check box. 5. Which tag is used to add drop-down list box to a form. Introduction Do you want to change the default values of the attributes of a tag? You can change it to your need using CSS. CSS stands for Cascading Style Sheets. The tags in HTML have their own function by default. These tags can be enhanced by using Style Sheet. A Style Sheet contains a set of instructions that modifies the values of the attributes of a tag. For example, the tag <H1> displays the text in black colour. The colour of the text can be changed for <H1> tag using Style Sheets. The advantages of using Style Sheets are: An attribute’s value of a tag can be specified once and the tag can be used anywhere in the file without specifying the attribute again and again. It is like changing the default value of an attribute. If you want to modify any attribute, it is enough if you change the value in the Style where it is defined instead of changing the values wherever the tag is used. Note CSS, Style Sheet and Cascading Style Sheet all mean the same. Styles can be defined in 3 ways using: External Style Sheets, Internal Style Sheets and Inline Style Sheet 2.12.1 External Style Sheets In the External Style Sheets, the tags that are necessary to create styles are saved in a file with extension .css. This file is linked to the HTML file by using Style Sheets 2.12-2
  • 3. Programming and Development Tools Web Programming the <LINK> tag in the HTML file. The <LINK> tag has HREF attribute to which the URL of the style sheet file (.css) is assigned. The <LINK> tag is placed inside the <HEAD> tag. Hands-On! The following example illustrates the use of External Style Sheets in a Webpage. Open the HTML file Ext_CSS.html in Internet Explorer. The code in Ext_CSS.html file is given below: <HTML> <HEAD> <TITLE> CSS </TITLE> <link REL="StyleSheet" TYPE="text/css" HREF="Style1.css"> </HEAD> <BODY><FONT Size=5> <H1> WORLD POPULATION : 2003 </H1> The first five most populous countries are: <BR> <OL> <LI> China <LI> India <LI> United States <LI> Indonesia <LI> Brazil </OL> <TABLE Cellspacing=0 Align="Center"> <TR Bgcolor="Darkgreen" Height="40"> <TH Width="20%"> S.No.<TH Width="40%">Country<TH Width="40%"> Population</TR> <TR> <TD>1 <TD>China <TD>1,286,975,468 </TR> <TR> <TD>2 <TD>India <TD>1,049,700,118 </TR> <TR> <TD>3 <TD>United States<TD>290,342,554 </TR> <TR> <TD>4 <TD>Indonesia <TD>234,893,453 </TR> <TR> <TD>5 <TD>Brazil <TD>182,032,604 <TR> </TABLE> </FONT> </BODY> Style Sheets 2.12-3
  • 4. Programming and Development Tools Web Programming </HTML> Code Sample 2.12.1 The Web page shown in Figure 2.12.1 is displayed in the browser window. Figure 2.12.1: A Web Page Using External Style Sheet In the code shown in Code Sample 2.12.1, the tag <link Rel="StyleSheet" Type="text/css" Href="Style1.css"> creates a link to the Style1.css file. The following are the tags specified in Style1.css file: H1 {Text-Align:Center;color:Firebrick} BODY {Background:LightYellow} TABLE{Border:outset 5pt;Background- Image:URL("Picture2.jpg");Width:60%;Color:yellow;Font- size=20} TD {Text-Align: Center; Height: 40} OL {Color:Firebrick} Code Sample 2.12.2 The following is the syntax used to modify the attributes of a tag: Tag_Name {Attribute1: Value; Attribute2: Value; …………..} Style Sheets 2.12-4
  • 5. Programming and Development Tools Web Programming It is clear from the Code Sample 2.12.2 that <H1>, <BODY>, <TABLE>, <TD> and <OL> are the tags that are modified. The following are the changes made: The Color attribute is set to Firebrick and the text is centered for <H1> tag. The Background Color is set to Lightyellow for the <BODY> tag. The border width is set to 5, Picture2.jpg is set as the background image, table width is set to 60% of the width of the browser window, the colour of the text is set to Yellow and the size of the text is set to 20 for the <TABLE> tag. The Height of a cell is set to 40 and the text is centered for <TD> tag. The colour is set to Firebrick for <OL> tag. When these modified tags are used in your HTML file, the tags take the values of the attributes mentioned in the .css file unless the attributes are specified. For example, the heading of the Web page shown in Figure 2.12.1 is centered instead of left alignment. Note External Style Sheet is also called as Linked Style Sheet Self-Check Exercise 2.12.1 Say true or false: 1. In External Style Sheets, styles are defined in a separate file with extension .ccs. 2. The 3 ways of defining styles are using External Style Sheets, Internal Style Sheets and Inline Styles. 3. The <LINK> tag is placed inside the <HEAD> tag. Lab Exercise Lab Exercise 1: Open D12_1.html in Internet Explorer. The following code will be present in D12_1.html. <HTML> <HEAD> <TITLE> WELCOME TO ZAI SUPER MARKET </TITLE> <LINK REL="STYLESHEET" TYPE="TEXT/CSS" HREF="D12_1.CSS"> <H5 ALIGN="CENTER"> WELCOME TO ZAI SUPER MARKET </H5> <H1 ALIGN="CENTER"> Style Sheets 2.12-5
  • 6. Programming and Development Tools Web Programming No.3 Plaza Dhamas, &nbsp; Sri Hartamaas <BR> Kuala Lumpur <BR><BR> </H1> </HEAD> <BODY> <CENTER> <TABLE BORDER=1> <TR> <TH WIDTH=10%>S.NO </TH> <TH WIDTH=50%> PRODUCT NAME</TH> <TH WIDTH=20%>QTY</TH> <TH WIDTH=15%> PRICE </TH> </TR> <TR> <TD ALIGN="CENTER">101 </TD> <TD> Coke</TD> <TD> 250 ML</TD> <TD> 1.70 RM</TD> </TR> <TR> <TD ALIGN="CENTER">102 </TD> <TD> Pepsi</TD> <TD> 250 ML</TD> <TD> 1.50 RM</TD> </TR> <TR> <TD ALIGN="CENTER">102 </TD> <TD>Sprit</TD> <TD> 250 ML</TD> <TD> 1.50 RM</TD> </TR> <TR> <TD ALIGN="CENTER">102 </TD> <TD> 100 Plus</TD> <TD> 250 ML</TD> <TD> 1.00 RM</TD> </TR> <TR> <TD ALIGN="CENTER">102 </TD> <TD> Milo </TD> <TD> 150 ML</TD> <TD> 1.30 RM</TD> </TR> <TR> Style Sheets 2.12-6
  • 7. Programming and Development Tools Web Programming <TD ALIGN="CENTER">102 </TD> <TD> Lychee </TD> <TD> 150 ML</TD> <TD> 1.20 RM</TD> </TR> </TABLE> </CENTER> </BODY> </HTML> 1. Locate the tag which is used to call the external style sheet file into html file. 2. Identify the attribute which is used to define the relationship between the linked file and the HTML file. 3. Name the attribute which is used to specify the type of the file. Lab Exercise 2: Open D12_1.HTML in Notepad. 1. View the source code in the Notepad. 2. Change the background and text colour as shown in the following Figure 2.12.2. Figure 2.12.2: Welcome to ZAI Super Market Lab Exercise 3: Create an external style sheet and display the output as given in the following Figure 2.12.3. Style Sheets 2.12-7
  • 8. Programming and Development Tools Web Programming Figure 2.12.3: Wonders of the World 2.12.2 Internal Style Sheets In the Internal Style Sheets, the tags that are necessary to create styles are placed inside the <STYLE> tag. The <STYLE> tag is placed inside the <HEAD> tag of the HTML file. Note Internal Style Sheets are also called as Embedded Style Sheets. Hands-On! The following example illustrates the use of Internal Style Sheets in a Webpage. Open the HTML file Int_CSS.html in Internet Explorer. The code in Int_CSS.html file is given below: <HTML> <HEAD> <TITLE> CSS </TITLE> Style Sheets 2.12-8
  • 9. Programming and Development Tools Web Programming <STYLE Type="text/css"> H1 {Text-Align:Center;color:Firebrick} BODY {Background:LightYellow} TABLE{Border:outset 5pt; Background-Image:URL("Picture2.jpg"); Width:60%;Color:yellow;Font-size=20} TD {Text-Align:Center;Height:40} OL {Color:Firebrick} </STYLE> </HEAD> <BODY><FONT Size=5> <H1> WORLD POPULATION : 2003 </H1> The first five most populous countries are: <BR> <OL> <LI> China <LI> India <LI> United States <LI> Indonesia <LI> Brazil </OL> <TABLE Cellspacing=0 Align="Center"> <TR Bgcolor="Darkgreen" Height="40"> <TH Width="20%"> S.No.<TH Width="40%">Country<TH Width="40%"> Population</TR> <TR> <TD>1 <TD>China <TD>1,286,975,468 </TR> <TR> <TD>2 <TD>India <TD>1,049,700,118 </TR> <TR> <TD>3 <TD>United States<TD>290,342,554 </TR> <TR> <TD>4 <TD>Indonesia <TD>234,893,453 </TR> <TR> <TD>5 <TD>Brazil <TD>182,032,604 <TR> </TABLE> </FONT> </BODY> </HTML> Code Sample 2.12.3 The same Web page shown in Figure 2.12.1 is displayed in the browser window. Style Sheets 2.12-9
  • 10. Programming and Development Tools Web Programming In External Style Sheets, you created a file with extension .css. This file contains all the tags that were used to define the styles. In Internal Style Sheet, all the tags that are required to define the styles are placed inside the <STYLE> and </STYLE> tags which in turn is placed inside the <HEAD> and </HEAD> tags. The difference between External Style Sheet and Internal Style Sheet is that the former can be used by any HTML file whereas the latter can be used only by the HTML file where it is defined. Note No separate file is created for defining styles in Internal Style Sheets. 2.12.3 Inline Style Sheets In the Inline Styles, the styles are inserted directly into the tags by assigning styles to the Style attribute of respective tags. Hands-On! The following example illustrates the use of Inline Styles in a Webpage. Open the HTML file Inl_CSS.html in Internet Explorer. The code in Inl_CSS.html file is given below: <HTML> <HEAD> <TITLE> CSS </TITLE> </HEAD> <BODY Style=Background:LightYellow><FONT Size=5> <H1 Style="Text-Align:Center;color:Firebrick"> WORLD POPULATION : 2003 </H1> The first five most populous countries are: <BR> <OL Style="Color:Firebrick"> <LI> China <LI> India <LI> United States <LI> Indonesia <LI> Brazil </OL> <TABLE Align="Center" Cellspacing="0" Style="Border:outset 5pt; Style Sheets 2.12-10
  • 11. Programming and Development Tools Web Programming Width:60%;Color:yellow;Font-size=20; Background:URL(Picture2.jpg)"> <TR Bgcolor="Darkgreen" Height="40"> <TH Width="20%"> S.No. <TH Width="40%">Country <TH Width="40%"> Population </TR> <TR> <TD Style="Text-Align:Center;Height:40">1 <TD>China <TD>1,286,975,468 </TR> <TR> <TD Style="Text-Align:Center;Height:40">2 <TD>India <TD>1,049,700,118 </TR> <TR> <TD Style="Text-Align:Center;Height:40">3 <TD>United States <TD>290,342,554 </TR> <TR> <TD Style="Text-Align:Center;Height:40">4 <TD>Indonesia <TD>234,893,453 </TR> <TR> <TD Style="Text-Align:Center;Height:40">5 <TD>Brazil <TD>182,032,604 </TR> </TABLE> </FONT> </BODY> Style Sheets 2.12-11
  • 12. Programming and Development Tools Web Programming </HTML> Code Sample 2.12.3 The same Web page shown in Figure 2.12.1 is displayed in the browser window. For example, the following code in Code Sample 2.12.3, sets the background colour of the Web page to Light yellow using Inline Styles. <BODY Style=Background:LightYellow> Here, the background of the Web page is set to Lightyellow by assigning the value to the Style attribute of the <BODY> tag. Order of Precedence If more than one type of Style Sheet is specified in a HTML file, the browser follows an order to select the Style Sheet to be used. The following is the order of precedence followed by a browser: 1. Inline Style Sheet 2. Internal or Embedded Style Sheet 3. External or Linked Style Sheet 4. Default style used by the browser (If the Style is not specified). If all the 3 Style Sheets are specified, the Internal Style Sheet adopts the styles mentioned in the External Style Sheet that are not mentioned in the Internal Style Sheet. The Inline Style Sheet adopts the styles mentioned in the Internal Style Sheet that are not mentioned in the Inline Style Sheet. Hence, it is called as Cascading Style Sheet. Lab Exercise Lab Exercise 4: Create an external style sheet and display the output as given in the following Figure 2.12.4. Style Sheets 2.12-12
  • 13. Programming and Development Tools Web Programming Figure 2.12.4: A Web Page Using External Style Sheet Self-Check Exercise 2.12.2 Fill in the blanks: 1. The tags that are required to define the styles using Internal Style Sheet are placed inside the _____ and _____ tags. 2. ______ attribute is used to specify Inline Styles. 3. ______ Style Sheet has the highest priority. Activity 2.12.1 1. Create a Web page that explains Cascading Style Sheets as shown in Figure 2.12.5. 2. Save the HTML file as Activity2.12.1.html. 3. The content of the same page is continued in Figure 2.12.6. Style Sheets 2.12-13
  • 14. Programming and Development Tools Web Programming Figure 2.12.5: A Web page Explaining CSS Figure 2.12.6: Continuation of Web page shown in Figure 2.12.5 Style Sheets 2.12-14
  • 15. Programming and Development Tools Web Programming Activity 2.12.2 As explained earlier, the Web pages created in the Activities of all the units from 3 to 12 will lead to the creation of a Web Site. The Web pages in all the Activities should be linked together. Do the following to create the home page for this Web site. 1. Create a Web page as shown in Figure 2.12.7 whose continuation is given in Figure 2.12.8. The files to be linked and their location are given in Table 2.12.1. 2. Save the HTML file as Index.html in C:HTML folder. Figure 2.12.7: A Web page Containing Links Style Sheets 2.12-15
  • 16. Programming and Development Tools Web Programming Figure 2.12.8: Continuation of Web page shown in Figure 2.12.7 Activity 2.12.3 The home page shown in Figure 2.12.9 contains two vertical frames. Load the file Index.html located at C:HTML folder in the left frame and Activity3.html located at C:HTMLUnit 7Activity folder in the right frame. When a link in the left frame is clicked, the corresponding page should be opened in the right frame. The link, the file to be linked and its location is given in Table 2.12.1. Link in the left File to be linked Location frame About the Internet Activity3.html C:HTMLUnit 7Activity Basics of HTML Activity5.html C:HTMLUnit 3Activity Adding Headings Activity1.html C:HTMLUnit 3Activity Inserting Line Breaks Activity2.html C:HTMLUnit 3Activity and Paragraphs Drawing Horizontal Activity3.html C:HTMLUnit 3Activity Rule Scrolling the Text Activity4.html C:HTMLUnit 3Activity Making the Text Bold, Activity1.html C:HTMLUnit 4Activity Style Sheets 2.12-16
  • 17. Programming and Development Tools Web Programming Italic and Underlined Changing the Size of Activity2.html C:HTMLUnit 4Activity the Text Positioning and Striking Activity3.html C:HTMLUnit 4Activity the Text Ordered List Activity1.html C:HTMLUnit 5Activity Unordered List Activity2.html C:HTMLUnit 5Activity Definition List Activity3.html C:HTMLUnit 5Activity Adding Hyperlinks Activity1.html C:HTMLUnit 6Activity Inserting Images Activity1.html C:HTMLUnit 7Activity Inserting Music, Movie Activity1.html C:HTMLUnit 8Activity and Animation Adding Tables Activity1.html C:HTMLUnit 9Activity Creating Frames Activity6.html C:HTMLUnit 10Activity Adding Forms and Activity2.html C:HTMLUnit 11Activity Controls Cascading Style Activity1.html C:HTMLUnit 12Activity Sheets Table 2.12.1: Details of files to be linked 1. Create a Web page shown in Figure 2.12.9. Save the HTML file as Main.html in C:HTML folder. 2. Save the HTML file as Main.html in C:HTML folder. 3. All the Web pages of a Web site should have the same appearance. So create an external style sheet file Style.css in C:HTML folder. The commands in Style.css is shown below: H1 {Text-Align:Center;Color:Firebrick} H2 {color:Firebrick} H3 {color:Firebrick} BODY {Background:Lightyellow;Font-Size:14pt} FONT {Font-Size:14pt} 4. Add the following code inside the <HEAD> tag in all the activity files created. <LINK Rel="Stylesheet" Href="C:HTMLStyle.css"> 5. Open the Main.html folder in Internet Explorer and browse the Web site created. Style Sheets 2.12-17
  • 18. Programming and Development Tools Web Programming Figure 2.12.9: Home page Technical Terminologies External Style Sheet - A Style Sheet placed in an external file with extension .css Internal Style Sheet - A Style Sheet placed internally in the same HTML file. Inline Style Sheet - Styles defined inside the tag using Style attribute. Cascading Style Sheet - The Style Sheet having higher precedence adopts the styles mentioned in a Style Sheet of lower precedence. This is called as Cascading Style Sheet. Summary In this unit, you learnt that CSS stands for Cascading Style Sheets. The 3 types of Style Sheets are Internal Style Sheet, External Style Sheet and Inline Style Sheet. In the External Style Sheets, the tags that are necessary to create styles are saved in a file with extension .css. In the Internal Style Sheets, the tags that are necessary to create styles are placed inside the <STYLE> tag. Style Sheets 2.12-18
  • 19. Programming and Development Tools Web Programming In the Inline Styles, the values that are necessary to create styles are assigned to the Style attribute of respective tags. Inline styles hold the highest priority among the Style Sheets. Assignment I. Answer the following questions: 1. List any 2 advantages of using Style Sheets. 2. Name the three Style Sheets. 3. Create a .css file to create an External Style Sheet that modifies the attributes of <TABLE> tag. 4. Write the <STYLE> tag to convert the External Style Sheet mentioned in 3rd question to Internal Style Sheet. 5. Write the <TABLE> tag to convert the Internal Style Sheet mentioned in 4th question to Inline Style Sheet. Style Sheets 2.12-19
  • 20. Programming and Development Tools Web Programming Criterion Referenced Test Instruction: Students must evaluate themselves to attain the list of competencies to be achieved. Name: Subject: Programming and Development Tools Unit: Style Sheets Please tick [ √ ] the appropriate box when you have achieved the respective competency. Date Style Sheets C1 C2 C3 Comment Competency codes: C1 = Create a Web page using External Style Sheet. C2 = Create a Web page using Internal Style Sheet. C3 = Create a Web page using Inline Style Sheet. Style Sheets 2.12-20