gpt4 book ai didi

css - 带有 CSS 的元素周期表

转载 作者:行者123 更新时间:2023-11-28 12:39:48 24 4
gpt4 key购买 nike

美好的一天!

所以目前我在仅使用外部 css 文件创建元素周期表时遇到了问题(我不允许使用标签)。

这是示例:

<!DOCTYPE html>
<html>

<head>
<title>Periodic Table</title>
<link rel="stylesheet" type="text/css" href="s3372661.css">
</head>

<body>
<div id="row_0">
<div id="1" class="element pos_0"> <span class="number">1</span>
<br> <span class="symbol">H</span>
<br> <span class="name">Hydrogen</span>
<br> <span class="molar">1.00794</span>
<br> <span class="group"></span>
<br>
</div>
<div class="element pos_1"></div>
<div class="element pos_2"></div>
<div class="element pos_3"></div>
<div class="element pos_4"></div>
<div class="element pos_5"></div>
<div class="element pos_6"></div>
<div class="element pos_7"></div>
<div class="element pos_8"></div>
<div class="element pos_9"></div>
<div class="element pos_10"></div>
<div class="element pos_11"></div>
<div class="element pos_12"></div>
<div class="element pos_13"></div>
<div class="element pos_14"></div>
<div class="element pos_15"></div>
<div class="element pos_16"></div>
<div id="2" class="element pos_17"> <span class="number">2</span>
<br> <span class="symbol">He</span>
<br> <span class="name">Helium</span>
<br> <span class="molar">4.002602</span>
<br> <span class="group">Element Noble p</span>
<br>
</div>
</body>
</htmt>

和 css 文件:

body {
background-color: #FFF;
width:960px;
display:table;
}
div {
display: table-row;
vertical-align: inherit;
border-radius: 7px;
-moz-border-radius: 7px;
-webkit-border-radius: 9px;
border: 3px solid #FFF;
background-color: red;
}
.element {
text-align: center;
padding: 10px 5px;
display: table-cell;
vertical-align: inherit;
min-width: 5em;
border: 2px #FFF solid;
background-color: inherit;
}
.number {
font-size:9px;
font-family:Arial, Helvetica, sans-serif;
color: white;
}
.symbol {
font-size:20px;
font-family:Arial, Helvetica, sans-serif;
color: white;
font-weight:bold;
}
.name {
font-size:15px;
font-family:Arial, Helvetica, sans-serif;
color: white;
font-style:italic;
}
.molar {
font-size:10px;
font-family:Arial, Helvetica, sans-serif;
color: white;
}
.group {
font-size:15px;
font-family:Arial, Helvetica, sans-serif;
color: white;
}

问题是如何在不对每个 block 使用特定性的情况下使那些不需要的 block 消失?

如:

#row_0 .element.pos_1 {
background-color: white
}

最佳答案

是否允许使用 CSS3 选择器?

.element:empty {
visibility: hidden;
}

关于css - 带有 CSS 的元素周期表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17744908/

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