IT Band of Brothers HTML5 CSS3 Secret CSS Tutorial Introduction

fd1e5d5373e04cd48c0b75f331c19dae.jpg

 

HTML uses tags to content on the web page, can also use elements and attributes to control the appearance of simple document. If you want more control over the appearance and layout of a Web page, you need to use Cascading Style Sheets (abbreviated as CSS). CSS works specification that allows users to develop some rules, described manifestation document element content by setting different rules control the appearance of every element of the page, including the width and color of the font color and size, line, page the amount of space between items, in order to make the page look more interesting. CSS and HTML as is the core and foundation of all Web production technology, is a mechanism to develop styles to HTML, can control the browser how to display each element in HTML and its contents. HTML and CSS are working together, to make up for the lack of HTML page formatting functions. Both HTML and CSS can be written in the same file, you can also write separately, are plain text files, it is also resolved by the browser. CSS syntax in this chapter covers only the contents of the book program instances involved.              

Introduction to CSS

CSS is an abbreviation of the English Cascading Style Sheets (Cascading Style Sheets), which is a method used performance such as HTML or XML document-style computer language, you should first understand before learning HTML CSS. CSS is the role of the appearance of the Web page (for example, fonts, backgrounds, text, location, layout, edge, and a list of others), it can also be a scripting language such as JavaScript and cooperation browser to make many dynamic effect.

Ø The so-called style sheets, HTML is a way of styling. HTML is the content of the document, and the style sheet is a document of the performance, or appearance.

The so-called laminated Ø, is to use a set of style laminated together, one or more control elements of HTML, style sheet attributes by sequentially displayed.

A style sheet can be used for more than one page, or even the entire site, so CSS has good ease of use and scalability. Generally speaking, not only can use CSS to make up for lack of HTML page formatting features, such as paragraph spacing, line spacing, font changes, and size, you can also use CSS dynamically updating the page formatting, typesetting positioning. CSS features are as follows:

Ø controls each element on the page (fine positioning).

Ø complement the style of the HTML language best treatment.

Ø The content and format of the phase separation process, to reduce the workload.

CSS we can define each tag in the HTML document, or to <style> tag is embedded in an HTML document, the document may be applied externally as an attached document. This example uses embedded style sheet, a change <h1> and 4 <p> tag output effect of the same HTML document. Using a text editor to open a Web page file .html extension, the three strings are written in HTML, a <h2> and two <p> tags. And using <style> tag is embedded in the document CSS code, the control display of the three markers. Code as follows:

d8a446543c1b428ca6bb0dabb3c88161.jpg

 

Use the browser directly open this file, you can see the results after the browser interprets the file on this page, shown in Figure 1.

562383439a5e41759ff66f0cec312400.jpg

CSS simple example demonstrates the results of Figure 1

In this example, HTML page structure defined using CSS output format, the format and structure can be separated. Just change some properties in CSS, HTML tags will use all the style updates.

Guess you like

Origin www.cnblogs.com/itxdl/p/11731111.html