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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930

-------- Page 1 (Lecture #10-01.jpg) ---------
Faculty of Information Technology – Tripoli University

مقدمة في برمجة الإنترنت
Introduction to Internet Programming
[ ITGS226 ]

المحاضرة العاشرة

أستاذة المادة
أ. وفاء حسين المصباحي

HTML5
JS
Cloud
XML
CSS3
flat
PHP
header
.com
footer
.net

2025 ربيع

-------- Page 2 (Lecture #10-02.jpg) ---------
المواضيع التي سيتم دراستها في مقرر : مقدمة في برمجة الانترنت
Introduction to Internet Programming
المحاضرة العاشرة

CSS - Cascading Style Sheets

1
WHAT IS CSS?

WHAT CAN DO WITH CSS?

INCLUDING CSS

INLINE STYLES

INTERNAL STYLE SHEETS

EXTERNAL STYLE SHEETS

-------- Page 3 (Lecture #10-03.jpg) ---------
CSS SYNTAX

COMMENTS IN CSS

CASE SENSITIVITY IN CSS

CSS SELECTORS

CSS COLOR

CSS BACKGROUND

Examples

-------- Page 4 (Lecture #10-04.jpg) ---------
CSS - Cascading Style Sheets

WHAT IS CSS?

• CSS is the key presentational technology that is used in website design.
• CSS stands for Cascading Style Sheets.
• CSS is a standard style sheet language used for describing the presentation (i.e. the layout and formatting) of the web pages.
• CSS was designed to enable the separation of presentation and content.
• CSS3 is the latest version of the CSS specification.
• CSS3 adds several new styling features and improvements to enhance the web presentation capabilities.

1

-------- Page 5 (Lecture #10-05.jpg) ---------
CSS - Cascading Style Sheets

WHAT CAN DO WITH CSS?

• Easily apply same style rules on multiple elements.

• Control the presentation of multiple pages of a website with a single style sheet.

• Change the position of an element on a web page without changing the markup.

• Alter the display of existing HTML elements.

• Create animations and transitions effects without using any JavaScript.

• Create print friendly version of your web pages.

2

-------- Page 6 (Lecture #10-06.jpg) ---------
CSS - Cascading Style Sheets

INCLUDING CSS

• CSS can either be attached as a separate document or embedded in the HTML document itself.

• There are three methods of including CSS in an HTML document:

  ○ Inline styles — Using the style attribute in the HTML start tag.

  ○ Embedded styles — Using the <style> element in the head section of a document.

  ○ External style sheets — Using the <link> element, pointing to an external CSS file.

Note:

- The inline styles have the highest priority, and the external style sheets have the lowest.

- Among all the three methods, using external style sheet is the best method for defining and applying styles to the HTML documents

3

-------- Page 7 (Lecture #10-07.jpg) ---------
CSS - Cascading Style Sheets

INLINE STYLES

- Inline styles are used to apply the unique style rules to an element by putting the CSS rules directly into the start tag.

- It can be attached to an element using the style attribute.

<h1 style="color:red; font-size:30px;">
    This is a heading
</h1>

<p style="color:green; font-size:22px;">
    This is a paragraph.
</p>

<div style="color:blue; font-size:14px;">
    This is some text content.
</div>

- Using the inline styles are generally considered as a bad practice. As it causes the presentation to become mixed with the content of the document; which negates the purpose of using CSS.

4

-------- Page 8 (Lecture #10-08.jpg) ---------
CSS - Cascading Style Sheets

INTERNAL STYLE SHEETS

• Embedded style sheets are defined in the <head> section of an HTML document using the <style> element.

<head>
…………

<title>My HTML Document</title>

<style>
  body { background-color: YellowGreen; }
  p    { color: #fff; }
</style>

…………

</head>

5

-------- Page 9 (Lecture #10-09.jpg) ---------
CSS - Cascading Style Sheets

EXTERNAL STYLE SHEETS

• An external style sheet is ideal when the style is applied to many pages of the website.

• An external style sheet holds all the style rules in a separate document that you can link from any HTML file on your site.

• External style sheets are the most flexible because with an external style sheet, you can change the look of an entire website by changing just one file.

• An external style sheet can be linked to an HTML document using the <link> tag. The <link> tag goes inside the <head> section.


<head>
............
    <title>My HTML Document</title>

    <link rel="stylesheet" type="text/css" href="..........css">

............
</head>

6

-------- Page 10 (Lecture #10-10.jpg) ---------
CSS - Cascading Style Sheets

CSS SYNTAX

• A CSS rule have two main parts, a selector and one or more declarations:

selector {
    property:value;
    property:value;
    property:value;
    …
}

h1 { color: blue; text-align: center; }

• The selector specifies which element or elements in the HTML page the CSS rule applies to.

• The declarations within the block determines how the elements are formatted on a webpage.

• Each declaration consists of a property and a value separated by a colon (:) and ending with a semicolon (;), and the declaration groups are surrounded by curly braces {}.

7

-------- Page 11 (Lecture #10-11.jpg) ---------
CSS - Cascading Style Sheets

CSS SYNTAX

- The property is the style attribute you want to change; they could be font, color, background, etc.

- Each property has a value, for example color property can have value either blue or #0000FF etc.

    h1 {color:blue; text-align:center;}

- h1 is a selector, color and text-align are the CSS properties, and the given blue and center are the corresponding values of these properties.

- A CSS declaration always ends with a semicolon ";", and the declaration groups are always surrounded by the curly brackets "{}".

-------- Page 12 (Lecture #10-12.jpg) ---------
CSS - Cascading Style Sheets

COMMENTS IN CSS

- A CSS comment begins with /*, and ends with */

- Comments are usually added with the purpose of making the source code easier to understand. It may help other developer (or you in the future when you edit the source code) to understand what you were trying to do with the CSS.

- Comments are significant to programmers but ignored by browsers.

div {
    background-attachment: fixed;      /* default value: scroll */
}

-------- Page 13 (Lecture #10-13.jpg) ---------
CSS - Cascading Style Sheets

CASE SENSITIVITY IN CSS

• CSS property names and many values are not case-sensitive.

• Whereas, CSS selectors are usually case-sensitive.

• Therefore, to be on safer side, you should assume that all components of CSS rules are case-sensitive.

10

-------- Page 14 (Lecture #10-14.jpg) ---------
CSS - Cascading Style Sheets

CSS SELECTORS

- Selectors are one of the most important aspects of CSS as they allow you to target specific elements on your web page in various ways so that they can be styled.

- Several types of selectors are available in CSS:

1. Universal Selector

• The universal selector, denoted by an asterisk (*), matches every single element on the page.

    * { margin: 0; padding: 0; }

• The style rules inside the * selector will be applied to every element in a document.

• It is recommended not to use the universal selector (*) too often, Use element type or class selector instead.

2. Element Type Selectors

    p { color: blue; }

• The style rules inside the p selector will be applied on every <p> element (or paragraph) in the document and color it blue, regardless of their position in the document tree.

11

-------- Page 15 (Lecture #10-15.jpg) ---------
CSS - Cascading Style Sheets

CSS SELECTORS

3.    Id Selectors
      • The id selector is used to define style rules for a single or unique element.
      • The id selector is defined with a hash sign (#) immediately followed by the id value.
            #error { color: red; }
      • This style rule renders the text of an element in red, whose id attribute is set to error.

4.    Class Selectors
      • The class selectors can be used to select any HTML element that has a class attribute. All
        the elements having that class will be formatted according to the defined rule.
      • The class selector is defined with a period sign (.) immediately followed by the class value.
            .blue { color: blue; }
      • The above style rules renders the text in blue of every element in the document that
        has class attribute set to blue.
            p.blue { color: blue; }
      • The style rule inside the selector p.blue renders the text in blue of only those <p> elements
        that has class attribute set to blue, and has no effect on other paragraphs.

-------- Page 16 (Lecture #10-16.jpg) ---------
CSS - Cascading Style Sheets

CSS SELECTORS

5.    Grouping Selectors

•    Often several selectors in a style sheet share the same style rules declarations. You can group them into a comma-separated list to minimize the code in your style sheet. It also prevents you from repeating the same style rules over and over again.

        h1, h2, h3 { font-weight: normal; }

•    The same style rule font-weight: normal; is shared by the selectors h1, h2 and h3, so it can be grouped in a comma-separated list.

13

-------- Page 17 (Lecture #10-17.jpg) ---------
CSS - Cascading Style Sheets

CSS COLOR

- The color property defines the text color of an element.

- Colors in CSS most often specified in the following formats:
  • a color keyword - like "red", "green", "blue", "transparent", etc.
    h1 { color: red; }
  • a HEX value - like "#ff0000", "#00ff00", etc.
    p { color: #00ff00; }
  • an RGB value - like "rgb(255, 0, 0) "
    h1 { color: rgb(255, 165, 0); }

- The color names are case-insensitive.
- The color property normally inherits the color value from their parent element,
- rgb(255, 255, 255) ----- the color would be white.
- rgb(0, 0, 0) ----- the color would be black.

14

-------- Page 18 (Lecture #10-18.jpg) ---------
CSS - Cascading Style Sheets

CSS BACKGROUND

• CSS provide several properties for styling the background of an element.

• The background-color property is used to set the background color of an element ( + opacity property).
  background-color:#CF1A11;

• The background-image property set an image as a background of an HTML element. By default browser repeats the background image both horizontally and vertically to fill the entire area of an element.
  background-image:url(‘image.jpg’);

• The background-repeat property allows you to control how a background image is repeated in the background of an element. The background image can be repeated horizontally (x-axis) using repeat-x or vertically (y-axis) using repeat-y preventing the repetition using no-repeat. Space and round are other values to specify repetition.
  background-repeat:no-repeat;
  background-repeat:repeat;
  background-repeat:repeat-x;
  background-repeat:repeat-y;

15

-------- Page 19 (Lecture #10-19.jpg) ---------
CSS - Cascading Style Sheets

CSS BACKGROUND

• The background-position property is used to specify the position of the background image.

background-position:center center;
background-position:center top;
background-position:center bottom;
background-position:left top;
background-position:left center;
background-position:left bottom;
background-position:right top;
background-position:right center;
background-position:right bottom;

top left     top center     top right
center left  center center  center right
bottom left  bottom center  bottom right

• The background-clip property defines how far the background (color or image) should extend within an element. It has the values: border-box, padding-box or content-box.

• The background-origin property specifies the origin position (the background positioning area) of a background image. It has the same values of the clip property.

16

-------- Page 20 (Lecture #10-20.jpg) ---------
CSS - Cascading Style Sheets

CSS BACKGROUND

• The background-size property Specifies the size of the background image(s). It has four values: auto (original size), cover (resize to cover the container), contain (fully visible), length (width and height) or percentage (% of the parent).

div {

    background-size: cover;     /* default value: auto */

    background-size: contain;

}

background-size:

auto;        50% 100%;        cover;        contain;

-------- Page 21 (Lecture #10-21.jpg) ---------
CSS - Cascading Style Sheets

CSS BACKGROUND

• The background-shorthand property to specify all the background properties in one single property. When using the shorthand property the order of the property values is: background-color, background-image, background-repeat, background-attachment then background-position.

• The background-attachment property specifies whether the background image should scroll or be fixed.

div {
    background-attachment: fixed;     /* default value: scroll */
}

18

-------- Page 22 (Lecture #10-22.jpg) ---------
CSS - Cascading Style Sheets

CSS BACKGROUND NOTES

• By default, a background-image is placed at the top-left corner of an element. Other values such as Left top, right center and center bottom. If you only specify one keyword, the other value will be “center“. The first value is the horizontal position and the second value is the vertical. The top left corner is 0% 0%. The right bottom corner is 100% 100%. If you only specify one value, the other value will be 50%. Default value when using percentage is: 0% 0%

• If two values are specified for the background-position property, the first value represents the horizontal position, and the second represents the vertical position. If only one value is specified, the second value is assumed to be center.

• It does not matter if one of the property values is missing in the background shorthand, as long as the other ones are in this order.

19

-------- Page 23 (Lecture #10-23.jpg) ---------
Example 1 :  INTERNAL STYLE SHEETS  -  Class Selectors - Element Type Selectors

<html lang="en">
    <head>
        <title> صفحة اختبار لخصائص الخلفية </title>
        <meta charset='utf-8'>
        <style type="text/css">
            .firstP{
                background-color:black;
                color:white;
            }
            .secondP{
                background-image:url('myPic.jpg');
                background-repeat:no-repeat;
                background-positive:center center;
            }
            p{direction:rtl;}
        </style>
    </head>
    <body>
        <p class="firstP">
            العنصر الأول سيبدو بخلفية سوداء ولون نص أبيض
        </p>
        <p class="secondP">
            العنصر الثاني سيبدو بخلفية صورية ولونها <br/><br/>
            العنصر الثاني سيبدو بخلفية صورية ولونها <br/><br/>
            <br/>
            المساحة الكافية لعرض صورة الخلفية
        </p>
    </body>
</html>

20

-------- Page 24 (Lecture #10-24.jpg) ---------
( program#49.html ) عملي

EXPLORER
HTML LANGUAGE
program#36.html
program#37.html
program#38.html
program#39.html
program#40.html
program#41.html
program#42.html
program#43.html
program#44.html
program#45.html
program#46.html
program#47.html
program#48.html
program#49.html

program#49.html 1
program#49.html
html
head
style

<html lang="en">
  <head>
    <title> صفحة اختبار لخصائص الخلفية </title>
    <meta charset='utf-8'>
    <style type="text/css">
      .firstP{
        background-color:black;
        color:white;
      }
      .secondP{
        background-image:url('myPic.jpg');
        background-repeat:no-repeat;
        background-position:center center;
      }
      p{direction:rtl;}
    </style>
  </head>
  <body>
    <p class="firstP">
      العنصر الأول سيبدو بخلفية سوداء، ولون نص أبيض
    </p>

-------- Page 25 (Lecture #10-25.jpg) ---------
( program#49.html ) عملي

صفحة اختبار لخصائص الخلف

العنصر الاول سندر بخلفية سوداء وبلون نص أبيض

العنصر الثاني سندر بخلفية صورة ولونها

العنصر الثاني سندر بخلفية صورة ولونها

المساحة الكافية لعرض صورة الخلفية

22

-------- Page 26 (Lecture #10-26.jpg) ---------
Example 2 :  INLINE STYLES

<html lang="en">
  <head>
    <title>  صفحة اختبار  </title>
    <meta charset='utf-8'>
  </head>
  <body>

    <h1 style="color:red; font-size:30px;">
      This is a heading
    </h1>

    <p style="color:green; font-size:22px;">
      This is a paragraph.
    </p>

    <div style="color:blue; font-size:14px;">
      This is some text content.
    </div>

  </body>
</html>

23

-------- Page 27 (Lecture #10-27.jpg) ---------
( program#50.html ) عملي

EXPLORER
HTML LANGUAGE
program#36.html
program#37.html
program#38.html
program#39.html
program#40.html
program#41.html
program#42.html
program#43.html
program#44.html
program#45.html
program#46.html
program#47.html
program#48.html
program#49.html
program#50.html

OUTLINE
TIMELINE

program#50.html  x

program#50.html  html  HTML

1  <html lang="en">
2  <head>
3      <title> صفحة اختبار </title>
4      <meta charset='utf-8'>
5  </head>
6  <body>
7      <h1 style="color: red; font-size:30px;">
8          This is a heading
9      </h1>
10 
11     <p style="color: green; font-size:22px;">
12         This is a paragraph.
13     </p>
14 
15     <div style="color: blue; font-size:14px;">
16         This is some text content.
17     </div>
18 
19 </body>
20 </html>

File  Edit  Selection  …
HTML language

Ln 2, Col 11     Spaces: 4     UTF-8     CRLF     HTML

24
0  0  0

-------- Page 28 (Lecture #10-28.jpg) ---------
( program#50.html ) عملي

This is a heading
This is a paragraph.
This is some text content.

-------- Page 29 (Lecture #10-29.jpg) ---------
Example 3 : INTERNAL STYLE SHEETS - Id Selectors

<html lang="en">
    <head>
        <title> صفحة اختبار </title>
        <meta charset=‘utf-8’>
        <style type="text/css">
            #test1{
                background-color:green;
                font-size:30px;
                color:white;
            }
            #test2{
                color:red;
                font-size:22px;
            }
        </style>
    </head>
    <body>
        <h1 id="test1">This is a heading</h1>
        <p id="test2">This is a paragraph.</p>
    </body>
</html>

26

-------- Page 30 (Lecture #10-30.jpg) ---------
( program#51.html ) عملي

EXPLORER

HTML LANGUAGE
program#38.html
program#39.html
program#40.html
program#41.html
program#42.html
program#43.html
program#44.html
program#45.html
program#46.html
program#47.html
program#48.html
program#49.html
program#50.html
program#51.html

OUTLINE
TIMELINE

program#51.html  html > body > p#test2
<html lang="en">
  <head>
    <title> صفحة اختبار </title>
    <meta charset='utf-8'>
    <style type="text/css">
      #test1{
        background-color: green;
        font-size:30px;
        color: white;
      }

      #test2{
        color: red;
        font-size:22px;
      }
    </style>
  </head>
  <body>
    <h1 id="test1">This is a heading</h1>
    <p id="test2">This is a paragraph.</p>
  </body>
</html>

Ln 19, Col 16    Spaces: 4    UTF-8    CRLF    HTML

27

-------- Page 31 (Lecture #10-31.jpg) ---------
( program#51.html ) عملي

This is a heading

This is a paragraph.

-------- Page 32 (Lecture #10-32.jpg) ---------
Example 4 :  EXTERNAL STYLE SHEETS

<html lang="en">
  <head>
    <title> EXTERNAL STYLE SHEETS </title>
    <meta charset='utf-8'>
    <link rel="stylesheet" type="text/css" href="style.css">
  </head>
  <body>
    <h1>Hello world!</h1>
    <p>I ♥ CSS</p>
  </body>
</html>

Style.css

h1 {
  color: green;
  text-decoration: underline;
}

p {
  font-size: 25px;
  font-family: 'Trebuchet MS', sans-serif;
}

-------- Page 33 (Lecture #10-33.jpg) ---------
( program#52.html ) عملي

EXPLORER

HTML LANGUAGE
program#39.html
program#40.html
program#41.html
program#42.html
program#43.html
program#44.html
program#45.html
program#46.html
program#47.html
program#48.html
program#49.html
program#50.html
program#51.html
program#52.html
style.css

HTML language

program#52.html  style.css

program#52.html > html > body
1  <html lang="en">
2  <head>
3      <title> EXTERNAL STYLE SHEETS </title>
4      <meta charset='utf-8'>
5      <link rel="stylesheet" type="text/css" href="style.css">
6  </head>
7  <body>
8      <h1>Hello world!</h1>
9      <p>I ♥ CSS</p>
10 </body>
11 </html>

OUTLINE
TIMELINE

Ln 8, Col 1      Spaces: 4   UTF-8   CRLF   HTML

30

-------- Page 34 (Lecture #10-34.jpg) ---------
( style.css ) عملي

EXPLORER

HTML LANGUAGE
program#39.html
program#40.html
program#41.html
program#42.html
program#43.html
program#44.html
program#45.html
program#46.html
program#47.html
program#48.html
program#49.html
program#50.html
program#51.html
program#52.html

style.css

program#52.html  x
style.css  x

style.css  >  h1

h1 {
    color: green;
    text-decoration: underline;
}

p {
    font-size: 25px;
    font-family: 'Trebuchet MS', sans-serif;
}

OUTLINE
TIMELINE

Ln 1, Col 1 (142 selected)   Spaces: 4   UTF-8   CRLF   CSS

-------- Page 35 (Lecture #10-35.jpg) ---------
( program#52.html ) عملي

EXTERNAL STYLE SHEETS

Hello world!

I ♥ CSS

-------- Page 36 (Lecture #10-36.jpg) ---------
Example 5 : INTERNAL STYLE SHEETS

<html lang="en">
  <head>
    <title> INTERNAL STYLE SHEETS </title>
    <meta charset='utf-8'>
    <style type="text/css">
      h1 {
        color: green;
        text-decoration: underline;
      }

      p {
        font-size: 25px;
        font-family: 'Trebuchet MS', sans-serif;
      }
    </style>
  </head>
  <body>
    <h1>Hello world!</h1>
    <p>I ♥ CSS</p>
  </body>
</html>

33

-------- Page 37 (Lecture #10-37.jpg) ---------
( program#53.html ) عملي

EXPLORER
HTML LANGUAGE
program#41.html
program#42.html
program#43.html
program#44.html
program#45.html
program#46.html
program#47.html
program#48.html
program#49.html
program#50.html
program#51.html
program#52.html
program#53.html
style.css

OUTLINE
TIMELINE

program#53.html
program#53.html html head style
1  <html lang="en">
2  <head>
3      <title> INTERNAL STYLE SHEETS </title>
4      <meta charset='utf-8'>
5      <style type="text/css">
6          h1 {
7              color: green;
8              text-decoration: underline;
9          }
10
11         p {
12             font-size: 25px;
13             font-family: 'Trebuchet MS', sans-serif;
14         }
15      </style>
16  </head>
17  <body>
18      <h1>Hello world!</h1>
19      <p>I ♥ CSS</p>
20  </body>
21
Ln 5, Col 22   Spaces: 4   UTF-8   CRLF   HTML

34

-------- Page 38 (Lecture #10-38.jpg) ---------
( program#53.html ) عملي

INTERNAL STYLE SHEETS

Hello world!

I ♥ CSS

35

-------- Page 39 (Lecture #10-39.jpg) ---------
Thank you