CSS 8
CSS 8
o The CSS:
P {
padding:
10px;
border: 5px
solid green;
}
B. Border Width
• The properties for the border can be set separately. The border-width property specifies
the width of the border.
o The HTML:
<P CLASS="first">
Border width of this paragraph is set
to 2px.
</P>
<P CLASS="second">
Border width of this paragraph is set
to 5px.
</P>
o The CSS:
P.first {
padding: 10px;
border-style: solid;
border-width: 2px;
}
P.second {
padding: 10px;
border-style: solid;
border-width: 5px;
}
C. Border Color
• The border color of the element can be defined using a color name, RGB, or Hex values.
o The HMTL:
<P CLASS="first">
Border color has been created using <strong>color name.</strong>
</P>
<P CLASS="second">
Border color has been created using <strong>Hex values.</strong>
</P>
<P CLASS="third">
Border color has been created using <strong>RGB values.</strong>
</P>
o The CSS:
P.first {
padding: 10px;
border-style: solid;
border-width: 2px;
border-color: blue;
}
P.second {
padding: 10px;
border-style: solid;
border-width: 2px;
border-color: #FF6600;
}
P.third {
padding: 10px;
border-style: solid;
border-width: 2px;
border-color: rgb(0, 153, 0);
}
• In the example below, we set the minimum height and maximum width of different
paragraphs to 100px.
o The HTML:
<P CLASS="first">The <strong>minimum height </strong>
of this paragraph is set to 100px.</P>
<P class="second">The<strong> maximum width </strong>
of this paragraph is set to 100px.</P>
o The CSS:
P.first {
border: 5px solid green;
min-height: 100px;
}
P.second {
border: 5px solid green;
max-width: 100px;
}
o The CSS:
BODY {
background-image: url("CSS.png");
background-color: #e9e9e9;
}
• Background-image can be set not only for the whole page but for individual elements as
well.
• In the example below, we set a background image for the <P> element.
o The HTML:
<P>This paragraph has a background
image.</P>
o The CSS:
P {
padding: 30px;
background-image: url("green_photo.jpg");
color: white;
}
margin-top: 200px;
padding: 100px;
}
o The HTML:
<P>This paragraph has a background
image.</P>
</UL>
<UL CLASS="square">
<LI>Red</LI>
<LI>Green</LI>
<LI>Blue</LI>
</UL>
o The CSS:
OL.lower-alpha {
list-style-type: lower-alpha;
}
UL.circle {
list-style-type: circle;
}
UL.square {
list-style-type: square;
}
o The CSS:
caption {
caption-side: top;
}
• One of the most common uses of CSS with links is to remove the underline. In the
example below, the text-decoration property is used to remove the underline.
o The HTML:
<P><A HREF="http://www.sololearn.com"
target="_blank">
This link has no underline.
</A></P></A></P>
o The CSS:
A:link {
text-decoration: none;
}
• There are numerous other possible values for the cursor property, such as:
o default - the default cursor
o crosshair - the cursor displays as crosshair.
o pointer - the cursor displays hand icon.
References:
SoloLearn. (n.d.). HTML. Retrieved on May 07, 2018 from https://www.sololearn.com/Play/HTML
Beaird, J. & George, J. (2014). The principles of beautiful web design. Collingwood, AU: SitePoint
Pty. Ltd.