Introduction to CSS style classification (basic knowledge)

Introduction to CSS style classification (basic knowledge)

Classification of CSS styles

1. Internal style ---- inline style

Using the style tag

<style type="text/css">
/* Style */
</style>

Learn one more trick: write the common style of the page (if there are not many) in the style tag

2. Inline styles

Write it directly in the style attribute on the tag

<div style="color:red;">
    I am a box</div>

Learn one more trick: Usually used by backend programmers to modify the page

3. External Style

Create a new css file and associate it with the html page

a) Use tag association

<!-- In the head tag of the html -->
<link rel="stylesheet" type="text/css" href="css file path">

b) Use instruction association

<style type="text/css">
/* In the style tag */
    @import url("css file path")
</style>

Learn one more trick: The most commonly used external style and link tag in projects

Summary of three style sheets

Knowledge point supplement: CSS style classification

CSS styles can be divided into three categories: inline styles, internal style sheets, and external style sheets

1. Inline style (the style is written in the HTML tag and only works on the content of the tag)

Hello World!

2. Internal style (the style is written between the head tags of the HTML and only works on the content of the HTML)

<html>
    <head>  
    <title></title>
    <style type="text/css">
    body{font-size:12px}    
    </style>
    </head>
    <body></body>
</html>

3. External style (style reference is written between the head tags and works on the web page that references the CSS file)

<html>
    <head>  
    <title></title>
    <link href="common.css" rel="stylesheet" type="text/css"> 
    </head>
    <body></body>
</html>

In the css style, # represents the id selector, and . represents the class selector

<div class="font"></div>

<div id="top"></div> In HTML, the id cannot be repeated.

Summarize

This is the end of this article about the classification introduction of CSS styles (basic knowledge). For more relevant CSS style classification content, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future!

<<:  How to write the introduction content of the About page of the website

>>:  MySQL Query Cache Graphical Explanation

Recommend

How to isolate users in docker containers

In the previous article "Understanding UID a...

MySQL changes the default engine and character set details

Table of contents 1. Database Engine 1.1 View dat...

How to encapsulate axios in Vue project (unified management of http requests)

1. Requirements When using the Vue.js framework t...

Vue page monitoring user preview time function implementation code

A recent business involves such a requirement tha...

Example of customizing the style of the form file selection box

Copy code The code is as follows: <!DOCTYPE ht...

17 404 Pages You'll Want to Experience

How can we say that we should avoid 404? The reas...

Rules for using mysql joint indexes

A joint index is also called a composite index. F...

mysql 5.7.11 winx64 initial password change

Download the compressed version of MySQL-5.7.11-w...

JS implementation of carousel carousel case

This article example shares the specific code of ...

WeChat applet implements simple calculator function

WeChat applet: Simple calculator, for your refere...

How to develop Java 8 Spring Boot applications in Docker

In this article, I will show you how to develop a...

How to import txt into mysql in Linux

Preface When I was writing a small project yester...

Detailed explanation of how to configure openGauss database in docker

For Windows User Using openGauss in Docker Pull t...