//

Wednesday, December 18, 2019

Simple introduction to CSS

Why CSS

Cascading Style Sheets (CSS) is a language that controls and allows one to define the look of an HTML document. It permits the separation between the content of the HTML document from the style of the HTML file. CSS enables one to specify things such as the font you want on your page, the size of your text, the columns of the page, whether the text on a page is to be in bold or italics, background, link colors, margins, and placement of objects on a page and so on. by way of explanation, it is the part that controls the looks of a web page. With CSS, it is much easier to manage the appearance of multiple web pages since it separates the HTML element from display information. CSS also enables faster downloading of web pages, which is works best with older computers and modems. It provides a method for retaining a common style.

The coding of CSS style rules can be done in three places, namely:


  • Inline - done in the HTML tag.


  • Internal Style Sheet - coded at the beginning of a HTML document i.e. inside the <head></head> tags, and closed by the <style type=“text/css”> </style> tags.

  • External Style Sheet - this is a separate file with a .css extension which serves as a reference for multiple HTML pages with a path/link in the HTML pages pointing to browsers where to look for the styles.

CSS Syntax


CSS has two parts to a style rule.

  • CSS selectors- this is the core foundation of CSS since it defines the HTML element being manipulated with the CSS code.
  • The declaration- consists of one or more property (is the CSS element being manipulated) value (represents the value of the specified property) pairs, usually ends in a semi-colon and enclosed in curly brackets. For example,
CSS Syntax

Usage Example:


<head>
    <title>HTML Page</title>
    <link rel="stylesheet" href="css/style.css" />
</head>
Ref:
  1. Microsoft: DEV211.1x: JavaScript, HTML and CSS Web Development

No comments:

Post a Comment

Effective Branching Strategies in Development Teams

Effective Branching Strategies in Development Teams Effective Branching Strategies in Developme...