小编koz*_*koz的帖子

为什么将 html 元素的不透明度更改为 0.5 后,无法将 h1 元素的不透明度更改回 1?

我在 css 中向 html 元素添加了背景图像,以便它随着 Web 浏览器的大小而扩展。我将此 html 元素中的不透明度更改为 0.5。我想将子元素(特别是 h1 和段落元素)更改回不透明度 1,以便文本不透明。这不起作用。请帮忙 :)

HTML:

<!DOCTYPE html>
<html>
<head>
    <title>Title</title>
    <link rel = "stylesheet" href = "style.css">
</head>

<body>

    <p id ="topBar"></p>

    <h1>Heading</h1>

    <h3>Name</h3>

    <p> 
        Paragraph
    </p>

    <h3>Heading</h3>

    <p>More text</p>

    <h3>Send us an email!</h3>

    <form>
        <input style ="width:200px" type="email" placeholder ="Email" name="email"><br><br>
        <textarea style ="height:100px;width:200px"placeholder = "Message" name="message"></textarea><br><br>
        <input type="submit" value ="Send" name="send">
    </form>

    <p id ="bottomBar"></p>
</body>
 </html>
Run Code Online (Sandbox Code Playgroud)

CSS:

html {

background: url(pen.jpg) no-repeat center fixed;
background-size: cover;


font-family: …
Run Code Online (Sandbox Code Playgroud)

html css opacity

6
推荐指数
1
解决办法
4811
查看次数

标签 统计

css ×1

html ×1

opacity ×1