css学习记录,伪类选择符

:active将样式添加到被激活的元素
:focus将样式添加到被选中的元素
:hover当鼠标悬浮在元素的上方,向元素添加的样式
:link将样式添加到未被访问的元素
visited将样式添加到已被访问过的的元素
:first-child将样式添加到元素的第一个子元素
:lang设置元素使用特殊语言的内容样式

内容学习代码(和上面的没多大关系,只用到了:hover)

代码执行结果:

 


<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <title>css综合实验</title>
    <style type=text/css>
        <!-- body {
            background-image: url(https://img1.baidu.com/it/u=3987230652,1228670358&fm=253&fmt=auto&app=138&f=JPEG?w=700&h=467);
            background-size: 100% 50%;
            margin-bottom: 5%;
            font-size: 14px;
            font-family: Arial, Helvetica, sans-serif;
        }
        
        #main {
            width: 760px;
            height: 760px;
            background-image: url(https://tse2-mm.cn.bing.net/th/id/OIP-C.-U7by66jhNspg0G70UtQ1gHaDF?w=311&h=145&c=7&r=0&o=5&dpr=1.25&pid=1.7);
            opacity: 0.89;
            margin: auto;
        }
        
        #header {
            height: 20%;
            background-image: url(https://tse2-mm.cn.bing.net/th/id/OIP-C.-U7by66jhNspg0G70UtQ1gHaDF?w=311&h=145&c=7&r=0&o=5&dpr=1.25&pid=1.7);
            margin-bottom: 0%;
        }
        
        #header img {
            height: 40%;
            width: 100%;
        }
        
        ul {
            list-style: none;
            height: 60%;
        }
        
        ul li {
            float: left;
            width: 15%;
            height: 30px;
            margin-left: 3px;
            border: 2px solid rgb(40, 122, 199);
            border-radius: 15px;
            background-image: url(https://tse3-mm.cn.bing.net/th/id/OIP-C.7jXFyB3UKFaiolOlQfUlIQHaFL?w=218&h=180&c=7&r=0&o=5&dpr=1.25&pid=1.7);
        }
        
        ul li :hover {
            border: 2px solid rgb(40, 122, 199);
            border-radius: 15px;
            background-color: slategrey;
        }
        
        ul li a {
            display: block;
            text-align: center;
            width: 100%;
            height: 100%;
            color: black;
            letter-spacing: 5px;
            text-decoration: none;
            font-size: 16px;
        }
        
        #nav {
            height: 10%;
            width: 100%;
            margin-top: -5%;
            background-image: url(https://tse2-mm.cn.bing.net/th/id/OIP-C.-U7by66jhNspg0G70UtQ1gHaDF?w=311&h=145&c=7&r=0&o=5&dpr=1.25&pid=1.7);
        }
        
        #nav h1 {
            text-align: center;
        }
        
        #nav h3 {
            margin-top: -10px;
            text-align: center;
        }
        
        #content {
            background-image: url(https://img1.baidu.com/it/u=922488692,1235541444&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500);
            width: 70%;
            margin-left: 10%;
            height: 440px;
            padding: 40px;
            border: 2px solid black;
        }
        
        #content #img {
            background-color: black;
            float: left;
            width: 50%;
            height: 50%;
        }
        
        #content #text {
            font-weight: bold;
        }
        
        #content #img img {
            height: 100%;
            width: 100%;
        }
        
        #content #text p {
            font-size: 3em;
            float: left;
            margin: 0 .2em 0 0;
        }
        
        #footer {
            background-image: url(https://tse3-mm.cn.bing.net/th/id/OIP-C.7jXFyB3UKFaiolOlQfUlIQHaFL?w=218&h=180&c=7&r=0&o=5&dpr=1.25&pid=1.7);
            height: 6%;
            text-align: center;
        }
        
        #footer p {
            height: 20%;
        }
        
        -->
    </style>
</head>

<body>
    <div id="main">
        <div id="header">
            <img src="https://tse3-mm.cn.bing.net/th/id/OIP-C.ElEymsQwILUrUyZuT2ArJwHaET?w=328&h=190&c=7&r=0&o=5&dpr=1.25&pid=1.7" alt="头部图片">
            <ul>
                <li><a href="#"> 首页</a></li>
                <li><a href="#">文章</a></li>
                <li><a href="#">相册</a></li>
                <li><a href="#">博客</a></li>
                <li><a href="#">论坛</a></li>
                <li><a href="#">帮助</a></li>
            </ul>
        </div>
        <div id="nav">
            <h1>德国表示正努力应对能源挑战</h1>
            <h3>记者:朱晟 李超</h3>
        </div>
        <div id="content">
            <div id="img">
                <img src="https://img1.baidu.com/it/u=3810730580,1811892534&fm=253&fmt=auto&app=138&f=JPEG?w=650&h=366" alt="图片"></div>
            <div id="text">
                <p>德</p>国副总理兼经济和气候保护部长罗伯特·哈贝克25日表示, 德国正努力应对能源挑战,采取措施降低对俄罗斯能源的依赖度, 但也坦言这有难度。 哈贝克当天在联邦经济和气候保护部发表的一份声明中表示, 预计到今年年中,德国的俄罗斯石油进口量将减半,德国将力争在今年年底前“接近独 新华社柏林3月25日电(记者朱晟 李超)德国副总理兼经济和气候保护部长罗伯特·哈贝克25日表示, 德国正努力应对能源挑战,采取措施降低对俄罗斯能源的依赖度,但也坦言这有难度。    哈贝克当天在联邦经济和气候保护部发表的一份声明中表示,预计到今年年中,德国的俄罗斯石油进口量将减半,
                德国将力争在今年年底前“接近独立”。关于对俄罗斯天然气的依赖,哈贝克表示,尽管转换供应来源取得进展, 但这个过程依然存在难度,预计到2024年年中德国才可能基本不依赖俄罗斯天然气供应。 他说,即使目前德国正在逐步摆脱对俄罗斯能源的依赖,但在当前时点实施对俄能源禁运也为时过早,“其经济和社会后果仍将过于严重”。    哈贝克日前访问了卡塔尔和阿联酋,德卡两国达成一项长期能源合作协议,阿布扎比国家石油公司与德国多家公司签署谅解备忘录, 开展氢能合作以期取代化石燃料。
            </div>
        </div>
        <div id="footer">
            <p>关于海外网|广告服务|联系我们|网站地图</p>
            <p>海外网版权所有 ,未经书面授权禁止使用</p>
        </div>
    </div>
</body>


</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

weighless1129

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值