Page 86 - Computer - 7
P. 86
WAYS OF INSERTING CSS IN HTML
CSS can be inserted in an HTML document in one of the following ways:
• Inline CSS – An Inline CSS is defined in an HTML document inside the
<body> section to specify formatting for specific elements.
• Embedded (or Internal) CSS – An Embedded CSS is part of an HTML
document and is defined in the <head> section of the document
using the <style> element.
• External CSS – An External CSS is a separate document that contains
the style rules for various elements on a web page. It is specified in
the HTML document in the <head> section.
Knowledge Discovery Subject Enrichment
Similar to HTML documents, External CSS are created in Notepad. These files are saved with the extension
.css.
Let’s learn how to use Embedded CSS and Inline CSS to set properties of various elements on a web
page.
SETTING BACKGROUND PROPERTIES
Background properties are used to set the background style for a web page. The various background
properties are described in the table given below.
Property Description Value(s) Example
Specifies the background colour name, colour background-color :
background-color
colour value, transparent green
background- Specifies the background URL of the image file background-image :
image image url(‘computer.png’)
left top, left center,
left bottom, right top,
right center, right
background- Specifies the initial position bottom, center top, background-position:
position of the background image center center
center center,
center bottom, X% Y%,
x-position y-position
Specifies whether the
background image remains
background- fixed or scrolls when the fixed, scroll background-
attachment attachment: fixed
user scrolls down the web
page
84