gpt4 book ai didi

css - video 标签下面的任何标签都没有根据 css 代码进行格式化

转载 作者:行者123 更新时间:2023-11-28 02:32:45 26 4
gpt4 key购买 nike

我是 html 和 css 的初学者。我尝试了一些东西,有时编写的 css 代码有时不起作用,但我不知道为什么?我的错误在哪里?请帮我看一下代码,此代码中的错误是视频标签后的任何内容都没有改变颜色。

<!DOCTYPE html>
<html>
<head>
<title>

Just some experiments

</title>
<link href="./c.css" rel="stylesheet" type="text/css">

</head>

<body>

<h1 class="header">

This is the first and biggest heading

</h1>

<h2>

Now comes the subheading.

</h2>


<h3 id="subheading">

This is the third sub-heading. For this third sub-heading styling I
used the styling by the adjacent selectors i.e. h2+h3

</h3>
<h3 id="subheading">
This is the fourth sub-heading which has the size as that of the third
sub-heading.</h3>
<p>

This is supposed to be a paragraph. So without any waste of time,
I'll be pasting LOREM IPSUM.Lorem Ipsum is simply dummy text of the printing
and typesetting industry. Lorem Ipsum has been the industry's standard dummy
text ever since the 1500s, when an unknown printer took a galley of type and
scrambled it to make a type specimen book. It has survived not only five
centuries, but also the leap into electronic typesetting, remaining
essentially
unchanged. It was popularised in the 1960s with the release of Letraset
sheets
containing Lorem Ipsum passages, and more recently with desktop publishing
software like Aldus PageMaker including versions of Lorem Ipsum
<br>
<span href="css.txt">This is the child of the above paragraph.
</span><br>
<span id="vanquish">The name of the class of this span tag is just
seriously random and really means nothing but at the same time means a lot
to
many of the youths.<br> Vanquish is the flagship model of the Aston Martin.
</span>
<span href="desertsunset.png" id="vanquish"> Now we are out of the
previous span tag.now stepping into new span tag.</span>
</p>


<span> This is written in the span tag which is outside of the
paragraph tag which is only the descendent of the body tag.</span>

<video src="./video.MP4" width=640 height=480 controls>
Video is not supported by your browser</video>

<div id="main">
<span>Hi this is Srajan</span>
<span>This is the paragraph inside another paragraph</span>
<div> This is inside the div tag and now we'll be adding inside another p tag
<p>So this is actually being written inside two levels deep to the initial p tag. </p>
</div>
</div>

</body>

现在是 css 代码。

*{
font-family: arial;
color: lightgreen;
border-radius: 50px;
}

body{
background-color: black;
}

h2+h3{
color: aqua;
}

#subheading{
color: lavenderblush;
}

span[href]{
color: aqua;
}

#main{
font-size: 20px;
font-family: monospace;
color: white;
}

正如预期的那样,结果一定改变了视频下方标签的颜色,但它并没有发生请说明原因?

最佳答案

好的,所以这里的问题不在于 <video></video>标签。问题在于

 *{
font-family: arial;
color: lightgreen;
border-radius: 50px;
}

给你

color : lightgreen;

到 html 文档中的每一行文本。所以,当你写 `

#main{color:white;}

这仅适用于您为其编写的元素。在这种情况下只有 <div></div>元素获得白色文本。所以,当你写 <span><div> <span>采用默认颜色,即浅绿色。为了更好地理解,您可以尝试运行此代码:

<div id="main">
this text will be white
<span>this text will be lightgreen</span>
</div>

为避免此问题,请勿将整个文档设为浅绿色。而不是做一个类

.gr{color:lightgreen;}

并将其添加到您要使其变为浅绿色的标签中。或者如果你想按照你的方法进行(不推荐),那么只需更改你的代码

#main{color:white}

#main > span {color:white}

这会将白色应用于 <span>标签。

关于css - video 标签下面的任何标签都没有根据 css 代码进行格式化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47611707/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com