在此上下文中,HTML元素样式不允许作为元素节的子元素
错误:元素样式不允许在此上下文中作为元素节的子元素 守则:在此上下文中,HTML元素样式不允许作为元素节的子元素,html,css,Html,Css,错误:元素样式不允许在此上下文中作为元素节的子元素 守则: <section class="wrapper style4 container"> <h2 style="font-family:calibri;opacity:.0;"> something here </h2> <!-- Content --> <div class="content"> <section> <h2 st
<section class="wrapper style4 container">
<h2 style="font-family:calibri;opacity:.0;">
something here
</h2>
<!-- Content -->
<div class="content">
<section>
<h2 style="font-family:calibri;">something here</h2>
<p style="font-family:calibri;">
something here
</p>
<style>
table {
width: 100%;
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 5px;
text-align: left;
}
table#t01 tr:nth-child(even) {
background-color: #eee;
}
table#t01 tr:nth-child(odd) {
background-color: #fff;
}
table#t01 th {
background-color: black;
color: white;
}
</style>
</section>
</div>
这里有东西
这里有东西
这里有东西
桌子{
宽度:100%;
}
表,th,td{
边框:1px纯黑;
边界塌陷:塌陷;
}
th,td{
填充物:5px;
文本对齐:左对齐;
}
表#t01 tr:n个子项(偶数){
背景色:#eee;
}
表#t01 tr:n个孩子(奇数){
背景色:#fff;
}
表#t01第{
背景色:黑色;
颜色:白色;
}
有人能帮我解决这个错误吗 您不应该使用
样式
tag@Vivick您不应该使用style
标记-为什么不呢?它的使用经常会导致对CSS声明的级联属性的误解+使您的HTML变得更大,您可以使用外部表单轻松避免它。有人可以帮我修复错误吗?是的,把样式放在头上,我需要一张桌子,所以我用了。我应该如何在头脑中注入风格?有其他选择吗?