search
HomeWeb Front-endHTML TutorialW3School-CSS 伪类 (Pseudo-classes) 实例_html/css_WEB-ITnose

CSS 伪类 (Pseudo-classes) 实例

CSS 实例

  • CSS 背景实例
  • CSS 文本实例
  • CSS 字体(font)实例
  • CSS 边框(border)实例
  • CSS 外边距 (margin) 实例
  • CSS 内边距 (padding) 实例
  • CSS 列表实例
  • CSS 表格实例
  • 轮廓(Outline)实例
  • CSS 尺寸 (Dimension) 实例
  • CSS 分类 (Classification) 实例
  • CSS 定位 (Positioning) 实例
  • CSS 伪类 (Pseudo-classes)实例
  • CSS 伪元素 (Pseudo-elements)实例
  • 01超链接

    <!DOCTYPE html><html>    <head>        <meta charset="utf-8">        <title>01超链接</title>        <style type="text/css">            body {                background-color: #99CCFF;            }            a:link {                color: #CCCCCC;            }                        a:visited {                color: #666666;            }                        a:hover {                color: #ffffff;            }                        a:active {                color: #999999;            }        </style>    </head>    <body>        <p><b><a href="https://www.baidu.com/" target="_blank">百度首页</a></b></p>        <p><b>注释:</b>在 CSS 定义中,a:hover 必须位于 a:link 和 a:visited 之后,这样才能生效!</p>        <p><b>注释:</b>在 CSS 定义中,a:active 必须位于 a:hover 之后,这样才能生效!</p>        <img  src="/static/imghwm/default1.png"  data-src="love.jpg"  class="lazy" alt="W3School-CSS 伪类 (Pseudo-classes) 实例_html/css_WEB-ITnose" >    </body></html>

    02超链接2

    <!DOCTYPE html><html>    <head>        <meta charset="utf-8">        <title>02超链接2</title>        <style type="text/css">            body {                background-color: #99ccff;            }            a.one:link {color: #666;}            a.one:visited {color: #333;}            a.one:hover {color: #ffffff;}                        a.two:link {color: #666;}            a.two:visited {color: #333;}            a.two:hover {font-size: 150%;}                        a.three:link {color: #666;}            a.three:visited {color: #333;}            a.three:hover {background-color: #CCCCCC;}                            a.four:link {color: #666;}            a.four:visited {color: #333;}            a.four:hover {font-family: monospace;}                            a.five:link {color: #666;text-decoration: none;}            a.five:visited {color: #333;text-decoration: none;}            a.five:hover {text-decoration: underline;}                        </style>    </head>    <body>        <p><b><a class="one" href="https://www.baidu.com/" target="_blank">改变颜色</a></b></p>        <p><b><a class="two" href="https://www.baidu.com/" target="_blank">改变字体大小</a></b></p>        <p><b><a class="three" href="https://www.baidu.com/" target="_blank">改变背景颜色</a></b></p>         <p><b><a class="four" href="https://www.baidu.com/" target="_blank">As a man thinketh in his heart so is he!改变字体</a></b></p>        <p><b><a class="five" href="https://www.baidu.com/" target="_blank">改变文本装饰</a></b></p>    </body></html>

    03超链接::focus 的使用

    <!DOCTYPE html><html>    <head>        <meta charset="utf-8">        <title>03超链接::focus 的使用</title>        <style type="text/css">            input:focus {                background-color: #ccc;            }        </style>    </head>    <body>        <form>            <p>First name:                <input type="text" />            </p>            <p>Last name:                <input type="text" />            </p>            <p>                <input type="submit" value="Submit" />            </p>        </form>    </body></html>

    04 :first-child(首个子对象)

    <!DOCTYPE html><html>    <head>        <meta charset="utf-8">        <title>04:first-child(首个子对象)</title>        <style type="text/css">            p:first-child {                color: green;            }                        li:first-child {                text-transform: uppercase;            }        </style>    </head>    <body>        <div>            <p>These are the necessary steps:</p>            <ul>                <li>Intert Key</li>                <li>Turn key <strong>clockwise</strong></li>                <li>Push accelerator</li>            </ul>            <p>Do <em>not</em> push the brake at the same time as the accelerator.</p>        </div>    </body></html>

    05 :lang(语言)

    <!DOCTYPE html><html>    <head>        <meta charset="utf-8">        <title>05 :lang(语言)</title>        <style type="text/css">            q:lang(no) {                quotes: "~" "~";            }        </style>    </head>    <body>        <p>:lang 伪类允许您为不同的语言定义特殊的规则。在下面的例子中,在下面的例子中,:lang 类为带有值为 "no" 的 lang 属性的 q 元素定义引号的类型:</p>        <p>一些文本 <q lang="no">段落中的引用</q> 一些文本。</p>    </body></html>

    CSS 伪类 (Pseudo-classes) 总结

    Statement
    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
    What is the difference between an HTML tag and an HTML attribute?What is the difference between an HTML tag and an HTML attribute?May 14, 2025 am 12:01 AM

    HTMLtagsdefinethestructureofawebpage,whileattributesaddfunctionalityanddetails.1)Tagslike,,andoutlinethecontent'splacement.2)Attributessuchassrc,class,andstyleenhancetagsbyspecifyingimagesources,styling,andmore,improvingfunctionalityandappearance.

    The Future of HTML: Evolution and TrendsThe Future of HTML: Evolution and TrendsMay 13, 2025 am 12:01 AM

    The future of HTML will develop in a more semantic, functional and modular direction. 1) Semanticization will make the tag describe the content more clearly, improving SEO and barrier-free access. 2) Functionalization will introduce new elements and attributes to meet user needs. 3) Modularity will support component development and improve code reusability.

    Why are HTML attributes important for web development?Why are HTML attributes important for web development?May 12, 2025 am 12:01 AM

    HTMLattributesarecrucialinwebdevelopmentforcontrollingbehavior,appearance,andfunctionality.Theyenhanceinteractivity,accessibility,andSEO.Forexample,thesrcattributeintagsimpactsSEO,whileonclickintagsaddsinteractivity.Touseattributeseffectively:1)Usese

    What is the purpose of the alt attribute? Why is it important?What is the purpose of the alt attribute? Why is it important?May 11, 2025 am 12:01 AM

    The alt attribute is an important part of the tag in HTML and is used to provide alternative text for images. 1. When the image cannot be loaded, the text in the alt attribute will be displayed to improve the user experience. 2. Screen readers use the alt attribute to help visually impaired users understand the content of the picture. 3. Search engines index text in the alt attribute to improve the SEO ranking of web pages.

    HTML, CSS, and JavaScript: Examples and Practical ApplicationsHTML, CSS, and JavaScript: Examples and Practical ApplicationsMay 09, 2025 am 12:01 AM

    The roles of HTML, CSS and JavaScript in web development are: 1. HTML is used to build web page structure; 2. CSS is used to beautify the appearance of web pages; 3. JavaScript is used to achieve dynamic interaction. Through tags, styles and scripts, these three together build the core functions of modern web pages.

    How do you set the lang attribute on the  tag? Why is this important?How do you set the lang attribute on the tag? Why is this important?May 08, 2025 am 12:03 AM

    Setting the lang attributes of a tag is a key step in optimizing web accessibility and SEO. 1) Set the lang attribute in the tag, such as. 2) In multilingual content, set lang attributes for different language parts, such as. 3) Use language codes that comply with ISO639-1 standards, such as "en", "fr", "zh", etc. Correctly setting the lang attribute can improve the accessibility of web pages and search engine rankings.

    What is the purpose of HTML attributes?What is the purpose of HTML attributes?May 07, 2025 am 12:01 AM

    HTMLattributesareessentialforenhancingwebelements'functionalityandappearance.Theyaddinformationtodefinebehavior,appearance,andinteraction,makingwebsitesinteractive,responsive,andvisuallyappealing.Attributeslikesrc,href,class,type,anddisabledtransform

    How do you create a list in HTML?How do you create a list in HTML?May 06, 2025 am 12:01 AM

    TocreatealistinHTML,useforunorderedlistsandfororderedlists:1)Forunorderedlists,wrapitemsinanduseforeachitem,renderingasabulletedlist.2)Fororderedlists,useandfornumberedlists,customizablewiththetypeattributefordifferentnumberingstyles.

    See all articles

    Hot AI Tools

    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.

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    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 Article

    Hot Tools

    PhpStorm Mac version

    PhpStorm Mac version

    The latest (2018.2.1) professional PHP integrated development tool

    Dreamweaver CS6

    Dreamweaver CS6

    Visual web development tools

    ZendStudio 13.5.1 Mac

    ZendStudio 13.5.1 Mac

    Powerful PHP integrated development environment

    VSCode Windows 64-bit Download

    VSCode Windows 64-bit Download

    A free and powerful IDE editor launched by Microsoft

    WebStorm Mac version

    WebStorm Mac version

    Useful JavaScript development tools