Briefly talk about html usage

PHPz
Release: 2023-04-24 15:37:38
Original
501 people have browsed it
<p>HTML (HyperText Markup Language, Hypertext Markup Language) is one of the standard languages ​​used to create web pages. It provides a structured way to describe the content and appearance of a web page, and can be combined with other technologies such as CSS and JavaScript to achieve richer effects.

<p>HTML Basics

<p>HTML is actually a collection of tags that are used to specify the structure and style of text. Below is a basic HTML template, which contains the most basic HTML tags:

<!DOCTYPE html>
<html>
<head>
    <title>My Website</title>
</head>
<body>
    <h1>Hello, World!</h1>
    <p>Welcome to my website.</p>
</body>
</html>
Copy after login
<p>In the above code, <!DOCTYPE html> defines the document type and tells the browser The browser uses HTML5 to parse the document. The <html> tag represents the root element of the document and contains the entire document. <head>The tag contains the document's metadata, such as the title and style sheet. <title> tag is used to set the document title, which will be displayed on the title bar of the browser window. The <body> tag contains the main content of the document. The <h1> and <p> tags are used to represent titles and paragraphs, and are used to create the headline and body of text respectively.

<p>HTML tags

<p>The above is just the most basic HTML document structure. In fact, there are countless HTML tags. Here are some commonly used HTML tags:

Text tags

<ul> <li> <h1>~<h6>:Set title <li> <p>:Paragraph <li> <strong> or <b>: Bold text <li> <em> or <i>: Italic text <li> <u>: Underlined text <li> <strike> or &lt ;del>: Strikethrough text <li> <sup>: Superscript <li> <sub>: Subscript

Link tag

<ul> <li> <a>: link <li> <img>:image

List tag

<ul> <li> <ul>: Unordered list <li> <ol>: Yes Sequence list <li> <li>: List item

Table mark

<ul> <li> <table>:Table <li> <thead>:Table header <li> <tbody>:Table body <li> <tr>: Table row <li> <th>: Header cell <li> <td>: Table cell Grid <p> The above only lists some HTML tags. In fact, there are many types of HTML tags. Through these tags, we can easily implement various elements in the web page. (This is purely a personal opinion of some of the more commonly used tags, not all tags)

<p>CSS style

<p>HTML tags can set the structure of web content, but they should make the web page more beautiful and attractive. power, CSS is particularly important.

<p>CSS (Cascading Style Sheets) is a language used to describe the style of web pages. It allows us to more flexibly control the appearance of text, images, backgrounds and other elements, as well as details such as layout.

<p>CSS Basics

<p>In fact, CSS is also composed of a set of rules, as follows:

selector {
    property: value;
    property: value;
}
Copy after login
<ul> <li> selector: select Container that specifies the HTML element to which the style should be applied. <li> property: Attribute, used to specify the style attribute to be set. <li> value: Value, used to set the value of the attribute. <p>For example, to set the text color of all <h1> elements to red:

h1 {
    color: red;
}
Copy after login
<p>At this point, CSS will change all ## in the HTML The text color of #<h1> elements is set to red.

CSS Selector<p>

In CSS, a selector is an identifier used to determine the HTML element to which a style should be applied. The following are some commonly used CSS selectors: <p>

<ul> element selector: used to specify the HTML element to which the style is to be applied, such as <li>h1, p, a. Class selector: used to specify HTML elements with the same class to which styles are to be applied, such as <li>.header. ID selector: used to specify HTML elements with the same ID to which the style is to be applied, such as <li>#header. Descendant selector: used to specify the descendant elements to which the style is to be applied, such as <li>ul li. Child element selector: used to specify the direct child element to which the style is to be applied, such as <li>ul > li. Pseudo-class selector: used to specify the element in a specific state to which the style is to be applied, such as <li>:hover. The above only lists some commonly used CSS selectors. In fact, there are many kinds of CSS selectors, and they can be used in combination to achieve more complex selection effects. <p>

Summary<p>

HTML and CSS are two technologies that must be learned for front-end development. By learning these two technologies, you can easily build and beautify web pages. Of course, JavaScript can help us achieve more complex interactive effects in web pages. Combining the three technologies can achieve more powerful web pages. <p>

The above is the detailed content of Briefly talk about html usage. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!