国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Home Web Front-end CSS Tutorial Do You Know These Eight HTML5 Tags?

Do You Know These Eight HTML5 Tags?

Feb 22, 2025 am 10:39 AM

Do You Know These Eight HTML5 Tags?

Web developers utilize numerous HTML tags during website construction. While many are familiar with common HTML5 tags like <code><p></p>, <h1></h1>, and <div>, some lesser-known tags offer significant advantages. This article explores eight such tags, examining their W3C specifications and providing practical examples. <p><strong>Understanding HTML5 Tag Usage</strong></p> <p>W3C specifications provide conceptual overviews, but practical application can be challenging. Good practice isn't always strictly defined; this article offers recommended usage examples.</p> <p><strong>Key Takeaways</strong></p> <ul> <li>Use <code><mark></mark> to highlight text relevant to user activity, improving visibility.

  • Employ <small></small> for less important text, minimizing visual impact.
  • Use <q></q> for short inline quotes and <blockquote></blockquote> for longer excerpts, maintaining semantic accuracy.
  • Implement <ins></ins>, <del></del>, and <s></s> to mark additions, deletions, and corrections, useful in editing.
  • Organize <select></select> options with <optgroup></optgroup> to categorize choices, enhancing user experience.
  • 1. Contextual Highlighting with <mark></mark>

    The <mark></mark> tag denotes "relevance" or "scrutiny." Relevance is context-dependent; elements are relevant when useful during a specific activity. For example, search results could be marked with <mark></mark> to indicate relevance to the search query.

    Practical Example: On a "Cheapest Holiday Packages" page, the prices of the cheapest packages could be highlighted using <mark></mark>:

    <div class="deal-list">
      <div>
        <h2>Vanuatu Cruise</h2>
        <p><mark>9</mark> - 5 Nights</p>
        <p>A relaxing cruise...</p>
      </div>
      <div>
        <h2>Fiji Resort Getaway</h2>
        <p><mark>9</mark> - 6 Nights</p>
        <p>Includes all you can eat buffet...</p>
      </div>
      <div>
        <h2>Pacific Island Hiking</h2>
        <p>99 - 5 Nights</p>
        <p>Hike your way...</p>
      </div>
    </div>

    Best Practices: <mark> shouldn't be used solely for styling; use CSS for that. Don't use it to denote importance (use <code><strong> or <em> for that). Use <mark> to highlight relevance to the current user action.

    2. Lower Importance with <small>

    <small> reduces text size, a visual byproduct of its semantic meaning: denoting lower importance. Use it for less critical information, often found in footers or sidebars.

    Practical Example: In a footer:

    <small>Designed and developed by Simon Codrington. ? 2016 My Company - All rights reserved</small>

    Or in a product listing:

    <h3>Woolen Llama Print Jumper</h3>
    <em>.99</em><small> - Excludes tax</small>

    Best Practices: <small> cannot lower the importance of text already emphasized with <code><strong> or <em>. Don't use it solely for size control.

    3. Quotations with <q> and <blockquote>

    Use <q> for short inline quotes and <blockquote> for longer block quotes. These are for quotes, not styling (use <span> for that).

    Practical Example:

    <q>He hasn't eaten anything as good in his whole life!

    <div class="deal-list">
      <div>
        <h2>Vanuatu Cruise</h2>
        <p><mark>9</mark> - 5 Nights</p>
        <p>A relaxing cruise...</p>
      </div>
      <div>
        <h2>Fiji Resort Getaway</h2>
        <p><mark>9</mark> - 6 Nights</p>
        <p>Includes all you can eat buffet...</p>
      </div>
      <div>
        <h2>Pacific Island Hiking</h2>
        <p>99 - 5 Nights</p>
        <p>Hike your way...</p>
      </div>
    </div>

    Best Practices: Both support cite attributes (URL of the source) and <cite> tags (source title).

    4. Insertion, Deletion, and Correction with <ins>, <del>, and <s>

    <ins> marks added text, <del> removed text, and <s> text no longer correct. All support cite and datetime attributes for context.

    Practical Example:

    <small>Designed and developed by Simon Codrington. ? 2016 My Company - All rights reserved</small>

    Best Practices: Use <s> for corrections where the original is replaced. Don't use these solely for styling.

    5. Organizing Options with <optgroup>

    <optgroup> categorizes options within <select> elements, improving navigation. It has label and disabled attributes.

    Practical Example:

    <h3>Woolen Llama Print Jumper</h3>
    <em>.99</em><small> - Excludes tax</small>

    Best Practices: <optgroup> itself can't be selected or styled directly.

    6. Predefined Options with <datalist>

    <datalist> defines valid choices for <input> tags, providing a dropdown suggestion list.

    Practical Example:

    <blockquote>
      <p>Infuse your life with action. Don't wait for it to happen. Make it happen.</p>
      <cite>Bradley Whitford - Author</cite>
    </blockquote>

    Best Practices: Browser support varies; validation depends on the <input> type.

    In conclusion, these often-overlooked HTML5 tags offer valuable semantic enhancements and improved user experience. Understanding their proper usage leads to cleaner, more accessible, and more effective web development.

    The above is the detailed content of Do You Know These Eight HTML5 Tags?. For more information, please follow other related articles on the PHP Chinese website!

    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

    Hot AI Tools

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Clothoff.io

    Clothoff.io

    AI clothes remover

    Video Face Swap

    Video Face Swap

    Swap faces in any video effortlessly with our completely free AI face swap tool!

    Hot Tools

    Notepad++7.3.1

    Notepad++7.3.1

    Easy-to-use and free code editor

    SublimeText3 Chinese version

    SublimeText3 Chinese version

    Chinese version, very easy to use

    Zend Studio 13.0.1

    Zend Studio 13.0.1

    Powerful PHP integrated development environment

    Dreamweaver CS6

    Dreamweaver CS6

    Visual web development tools

    SublimeText3 Mac version

    SublimeText3 Mac version

    God-level code editing software (SublimeText3)

    Hot Topics

    PHP Tutorial
    1502
    276
    What is the difference between display: inline, display: block, and display: inline-block? What is the difference between display: inline, display: block, and display: inline-block? Jul 11, 2025 am 03:25 AM

    Themaindifferencesbetweendisplay:inline,block,andinline-blockinHTML/CSSarelayoutbehavior,spaceusage,andstylingcontrol.1.Inlineelementsflowwithtext,don’tstartonnewlines,ignorewidth/height,andonlyapplyhorizontalpadding/margins—idealforinlinetextstyling

    Styling visited links differently with CSS Styling visited links differently with CSS Jul 11, 2025 am 03:26 AM

    Setting the style of links you have visited can improve the user experience, especially in content-intensive websites to help users navigate better. 1. Use CSS's: visited pseudo-class to define the style of the visited link, such as color changes; 2. Note that the browser only allows modification of some attributes due to privacy restrictions; 3. The color selection should be coordinated with the overall style to avoid abruptness; 4. The mobile terminal may not display this effect, and it is recommended to combine it with other visual prompts such as icon auxiliary logos.

    Creating custom shapes with css clip-path Creating custom shapes with css clip-path Jul 09, 2025 am 01:29 AM

    Use the clip-path attribute of CSS to crop elements into custom shapes, such as triangles, circular notches, polygons, etc., without relying on pictures or SVGs. Its advantages include: 1. Supports a variety of basic shapes such as circle, ellipse, polygon, etc.; 2. Responsive adjustment and adaptable to mobile terminals; 3. Easy to animation, and can be combined with hover or JavaScript to achieve dynamic effects; 4. It does not affect the layout flow, and only crops the display area. Common usages are such as circular clip-path:circle (50pxatcenter) and triangle clip-path:polygon (50%0%, 100 0%, 0 0%). Notice

    How to create responsive images using CSS? How to create responsive images using CSS? Jul 15, 2025 am 01:10 AM

    To create responsive images using CSS, it can be mainly achieved through the following methods: 1. Use max-width:100% and height:auto to allow the image to adapt to the container width while maintaining the proportion; 2. Use HTML's srcset and sizes attributes to intelligently load the image sources adapted to different screens; 3. Use object-fit and object-position to control image cropping and focus display. Together, these methods ensure that the images are presented clearly and beautifully on different devices.

    What are common CSS browser inconsistencies? What are common CSS browser inconsistencies? Jul 26, 2025 am 07:04 AM

    Different browsers have differences in CSS parsing, resulting in inconsistent display effects, mainly including the default style difference, box model calculation method, Flexbox and Grid layout support level, and inconsistent behavior of certain CSS attributes. 1. The default style processing is inconsistent. The solution is to use CSSReset or Normalize.css to unify the initial style; 2. The box model calculation method of the old version of IE is different. It is recommended to use box-sizing:border-box in a unified manner; 3. Flexbox and Grid perform differently in edge cases or in old versions. More tests and use Autoprefixer; 4. Some CSS attribute behaviors are inconsistent. CanIuse must be consulted and downgraded.

    Demystifying CSS Units: px, em, rem, vw, vh comparisons Demystifying CSS Units: px, em, rem, vw, vh comparisons Jul 08, 2025 am 02:16 AM

    The choice of CSS units depends on design requirements and responsive requirements. 1.px is used for fixed size, suitable for precise control but lack of elasticity; 2.em is a relative unit, which is easily caused by the influence of the parent element, while rem is more stable based on the root element and is suitable for global scaling; 3.vw/vh is based on the viewport size, suitable for responsive design, but attention should be paid to the performance under extreme screens; 4. When choosing, it should be determined based on whether responsive adjustments, element hierarchy relationships and viewport dependence. Reasonable use can improve layout flexibility and maintenance.

    Describe the `opacity` property Describe the `opacity` property Jul 15, 2025 am 01:23 AM

    opacity is an attribute in CSS that controls the overall transparency of an element, with values ranging from 0 (fully transparent) to 1 (fully opaque). 1. It is often used for the image hover fade effect, and enhances the interactive experience by setting the opacity transition; 2. Making a background mask layer to improve text readability; 3. Visual feedback of control buttons or icons in the disabled state. Note that it affects all child elements, unlike rgba, which only affects the specified color part. Smooth animation can be achieved with transition, but frequent use may affect performance. It is recommended to use it in combination with will-change or transform. Rational application of opacity can enhance page hierarchy and interactivity, but it should avoid interfering with users.

    What is the accent-color property? What is the accent-color property? Jul 26, 2025 am 09:25 AM

    accent-color is an attribute used in CSS to customize the highlight colors of form elements such as checkboxes, radio buttons and sliders; 1. It directly changes the default color of the selected state of the form control, such as changing the blue check mark of the checkbox to red; 2. Supported elements include input boxes of type="checkbox", type="radio" and type="range"; 3. Using accent-color can avoid complex custom styles and extra DOM structures, and maintain native accessibility; 4. It is generally supported by modern browsers, and old browsers need to be downgraded; 5. Set accent-col

    See all articles