Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Defines a division or section in an HTML document Visually, allows us to make containers that can be formatted
<body> <h2>Fun with Div Tags and CSS</h2> <p>Aloha!</p> <p>Lets play with div tags. These tags create divisions within a web page that can be formatted using style elements. </p> </body>
</html>
Basic page
<div>
<p>Aloha!</p>
</div> <div>
<p>Lets play with div tags. These tags create divisions within a web page that can be formatted using style elements. </p>
</div>
</body>
</html>
<div style="color:blue">
<p>Aloha!</p>
</div>
</body>
</html>
<div style="color:blue">
<p>Aloha!</p>
</div>
</body>
</html>
Colored boxes
<head> <style type="text/css"> div.tip { border : solid 2px purple ; background-color : #FFDDFF ; margin : 1em ; padding : 0.5em ; } </style> </head>
<body> <h2>Format Many Boxes with One Style Sheet</h2> <p>Sometimes you want to add many boxes with the same formatting. You can use div tags to do this. However, putting style elements in each one of the boxes to be formatted can be time-consuming.</p>
<div class="tip"> Tip: Using a different background color helps call attention to text. </div>
</body> </html>
Marked-up manuscript
A
BA
Chapter One
fleur
graphic Mysterious Visitor It was a dark and stormy night. As was my custom on a Friday night, I was curled up in my favorite armchair reading Cataloging & Classification. ital. All of a sudden, I heard a loud b.f. Tap, tap, tap on the window. Wondering what type of person would be out and about on such a stormy night, I went over, pulled aside the curtain, and peered out into the darkness.
but first . . .
</p>
<h2>The Term</h2>
<p> The term "Style sheet" refers to a list of rules for formatting various elements. The word "Cascading" refers to the fact that you can have multiple style sheets which follow rules of precedence. </p> </body> </html>
<style type="text/css">
</style>
</HEAD>
Style-sheet rule
Selector Declaration block
h2 { color : blue ; }
Property Value
<style type="text/css">
h2 { color : blue ; }
</style>
</HEAD>
<style type="text/css"> body { background : #FFC0FF ; } h1 { color : green ; } h2 { color : blue ; } </style>
</HEAD>
#FFC0FF
Red
Green
Blue
Binary numbers
100 10 1
0 0 7
4 2 1
1 1 1
Base Ten 0 1 2 3 4 5 6 7 8 9 10
Hexadecimal numbers
Counting
2 5 5
100 10 1
Decimal number
0 0 1 F E D C B A 9 8 7 6 5 4 3 2 1
16 1
F F
256 16 1
Hexadecimal number
Base Ten 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Base 16 0 1 2 3 4 5 6 7 8 9 A B C D E F 10
00
00
00
#000000
FF 00
00
00
#FF0000
00
00 FF
00
#00FF00
00
00
FF 00
#0000FF
FF 00
FF 00
FF 00
#FFFFFF
00
FF 00
FF 00
#00FFFF
FF 00
00
FF 00
#FF00FF
FF 00
C0 00
FF 00
C0 12 x 16 = 192
#FFC0FF
<div>
<h2>Introduction</h2>
<p>Cascading Style Sheets (CSS) are used to format the way things appear on a Web page. When using Cascading Style Sheets HTML is used to provide structure and the style sheet is used to control how the elements look on the page. </p>
</div> <div>
<h2>The Term</h2>
<p>The term "Style sheet" refers to a list of rules for formatting various elements. The word "Cascading" refers to the fact that you can have multiple style sheets which follow rules of precedence. </p>
</div>
</body> </html>
<style type="text/css">
</style>
... </head>
<style type="text/css">
div.tip { border : solid 2px purple ; background-color : #FFDDFF ; margin : 1em ; padding : 0.5em ; }
</style>
... </head>
div.tip
<style type="text/css">
div.tip { border : solid 2px purple ; background-color : #FFDDFF ; margin : 1em ; padding : 0.5em ; }
</style>
... </head>
<style type="text/css">
div.tip { border : solid 2px purple ; background-color : #FFDDFF ; margin : 1em ; padding : 0.5em ; }
</style>
... </head>
<style type="text/css">
div.tip { border : solid 2px purple ; background-color : #FFDDFF ; margin : 1em ; padding : 0.5em ; }
</style>
... </head>
background-color : #FFDDFF ;
<style type="text/css">
div.tip { border : solid 2px purple ; background-color : #FFDDFF ; margin : 1em ; padding : 0.5em ; }
</style>
... </head>
margin : 1em ;
Margin attribute
Previous text.
Tip: Adding a margin around text emphasizes it.
Following text.
<style type="text/css">
div.tip { border : solid 2px purple ; background-color : #FFDDFF ; margin : 1em ; padding : 0.5em ; }
</style>
... </head>
padding : 0.5em ;
Margin attribute
Previous text.
Following text.
The padding is the space surrounding the text within the box.
The Result