Home >Web Front-end >H5 Tutorial >How to use h5 organized content
This time I will show you how to use h5 organizational content, how to use h5 organizational content? What are the precautions when using h5 to organize content? The following is a practical case, let’s take a look.
By default, the format of HTML document is not related to the format of the document content displayed in the browser window. For example: the browser will connect several white space characters together. Converts to a space, and newlines are ignored. HTML provides a way to organize content, segment displayed content, pre-format content, etc.
Create paragraphs
HTML will ignore carriage returns and other extra spaces you enter in the text. New paragraphs in the web page are marked with the p element. A paragraph contains one or more Related sentences usually revolve around a point or argument, or there are some common themes among multiple arguments.
<body> <h1>Antoni Gaudí</h1> <p>Many tourists are drawn to Barcelona to see Antoni Gaudí's incredible architecture.</p> <p>Barcelona celebrated the 150th anniversary of Gaudí's birth in 2002.</p> </body>
You can add styles to paragraphs, including fonts, font sizes, colors, etc.
div element
The div element has no specific meaning. If no appropriate element is available, you can use this element to structure the content and give it meaning. Its meaning is usually through the class or id attribute. specified.
But note that it is best not to use div elements as a last resort. Priority should be given to elements with semantic importance.
Pre-formatted content
The browser will compress all extra carriage returns and spaces and automatically wrap lines according to the size of the window. The pre element can change the way the browser handles content, preventing whitespace characters from being merged so that the formatting in the source document is preserved. Note, however, that it is best not to use this element unless it is necessary to preserve the original formatting of the document, because it reduces the flexibility of the mechanism to control the rendering results through the use of elements and styles. The
pre element is usually used in conjunction with the code element to display code examples, because formatting in programming languages is usually important.
<p>Add this to your style sheet if you want to display a dotted border underneath the <code>abbr</code> element whenever it has a <code>title</code> attribute.</p> <pre class="brush:php;toolbar:false"> <code> abbr[title] { border-bottom: 1px dotted #000; } </code>
Quoting content from elsewhere
The blockquote element represents a piece of content quoted from elsewhere, similar to the q element (used for short quotes, cannot cross lines), but is usually used in quotations Scenes with a lot of content. The cite attribute of this element can be used to specify the source of the content being quoted.
Add topic separation
The hr element represents paragraph-level topic separation. In HTML5, the hr element represents a transition to another related topic, and the custom style is a straight line across the page.
Note that the browser will ignore the format of the content in the blockquote element and indent the blockquote text by default. To establish structure in a quote, you can use some organizational elements such as p or hr.
Browsers will automatically add language-specific quotation marks to the text in the q element, but the effects of different browsers will vary. Below is an example using the q element.
<p>She tried again, this time in French: <q lang="fr">Avez-vous lu le livre <cite lang="en">High Tide in Tucson</cite> de Kingsolver? C'est inspirational.</q></p> <blockquote cite="http://en.wikipedia.org/wiki/Apple">
Topic 1
f32b48428a809b51f04d3228cdf461fa
Topic 2
f32b48428a809b51f04d3228cdf461fa
……
1aee16100a65d522474e4de7ff568f4a
The above example adds some hr elements to the blockquote element to form a certain structure.
Organize content into lists
The types of lists in HTML include ordered lists, unordered lists, and description lists.
1) Ordered list, ol is the parent element, li is the list item;
2) Unordered list, ul is the parent element, li is the list item;
3) Description list, dl is the parent element, dt and dd represent terms and descriptions in dl respectively.
In addition to this, users can also define their own lists.
I believe you have mastered the methods after reading these cases. For more exciting information, please pay attention to other related articles on the php Chinese website!
Related reading:
How to use video and audio tags and progress bars in H5
How to implement drag-and-drop function in H5
The above is the detailed content of How to use h5 organized content. For more information, please follow other related articles on the PHP Chinese website!