html css writing method

WBOY
Release: 2023-05-09 09:01:17
Original
1020 people have browsed it
<p>For beginners, HTML and CSS are essential tools for building web pages. The following will introduce some basic writing methods of HTML and CSS.

<p>Basic writing method of HTML:

<p>HTML is the basis of web pages. It defines the content on the page through tags. The following are some ways to write some basic HTML tags:

<p>1. Title tag:

<p>Use <h> tags to define titles, such as h1, h2, h3, etc. The smaller the number, the larger the font size.

<h1>这是一个一级标题</h1>
<h2>这是一个二级标题</h2>
<h3>这是一个三级标题</h3>
Copy after login
<p>2. Paragraph tags:

<p>Use <p> tags to define paragraphs.

<p>这是一个段落文本内容</p>
Copy after login
<p>3. Link tags:

<p>Use <a> tags to define links.

<a href="https://www.example.com">这是一个链接</a>
Copy after login
<p>4. Table tag:

<p>Use the <table> tag to define a table. The data in the table is defined in the <tr> tag, and each data cell is defined in the <td> tag.

<table>
  <tr>
    <td>第一行,第一列</td>
    <td>第一行,第二列</td>
  </tr>
  <tr>
    <td>第二行,第一列</td>
    <td>第二行,第二列</td>
  </tr>
</table>
Copy after login
<p>Basic CSS writing:

<p>CSS styles can be used to beautify web pages, such as changing colors, font styles, spacing, etc. The following is the basic writing method of CSS:

<p>1. Selector:

<p>The selector is used to locate HTML tags and then apply styles to them. For example:

  • #idname: Select the element whose id is "idname"
  • .classname: Select the element whose class is "classname" Element
  • tagname: Select the element with the tag name "tagname"
  • *: Select all elements
#title {
  color: blue;
  font-size: 25px;
}

.text {
  color: red;
  font-size: 18px;
}

body {
  background-color: gray;
}
Copy after login
<p>2. Attributes and attribute values:

<p>Attributes in CSS styles are used to set specific styles of elements. The value of the attribute depends on the specific situation, such as:

color:red;
width:100px;
height:50px;
padding:10px;
margin:5px;
Copy after login
<p>3. Notes:

<p> Comments are used to explain and illustrate the code, which can help others understand your code.

/* 这是一个注释 */
Copy after login
<p>Summary:

<p>HTML and CSS are two important parts of building a web page. Learning their basic syntax and rules will make it easier for you to write beautiful and standardized web pages.

The above is the detailed content of html css writing method. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template