HTML CSS

CSS (Cascading Style Sheets) A style used to render HTML element tags. For example, we learned to add a background color to <body>. Change the color of the text in the <p> tag, these are done with css

How to use CSS

CSS was originally introduced in HTML 4 and was introduced for better rendering of HTML elements.

CSS can be added to HTML in the following ways:

Inline style - use the "style" attribute in the HTML element

Internal style sheet - use the <style> element in the <head> section of the HTML document to include CSS

External references - use external CSS files

The best way is to externally reference CSS files. CSS files refer to files ending in .css. Our html files end in .html.

In our HTML tutorial, we used inline CSS styles to introduce examples, which is a simplified example and makes it easier to edit code online and run instances online.

You can learn more about CSS through the CSS tutorial CSS tutorial on this site.


Inline style


Inline styles are defined directly inside the HTML tags using the style attribute. We also mentioned the previous lessons. See the example below.

The css style above turns the text in the <p> tag black, then the text moves 20px to the left, and px refers to the pixel.


Internal style sheet

When a single file requires special styles, such as setting the two <P> tags to red, if you define them with inline styles, you need to write the css style on both <P> tags, if it is 5, 10<P > Labels, is it very troublesome, this is the use of our internal style sheet. You can define an internal style sheet in the <head> section via the <style> tag, like this:


External style sheet
An external style sheet is the ideal choice when styles need to be applied to many pages.

External style sheets are introduced into an external css file using the <link> tag. With an external style sheet, you can change the appearance of the entire site by changing a file.

For example, a css file defines that the background color of <body> turns yellow, the <h1> title turns red, <p> turns blue, and the css file is as follows

Body{background-color:yellow;}
p{color: blue;}
H1{color: red;}
Introducing css files with <link> in HTML files


HTML style tags



label       description
<style>Define text style
<link>Define resource reference address
Instance

The <a> link label we learned earlier, below is underlined, we use the css style to remove the underline


Last Updated: 2018-07-06 12:32:44 By akshay

SHARE THIS

share_facebook share_twitter share_google_plus

Please Comment Here :