我想要建立以下简单的用户界面,但我有一个粗略的时间以正确的方式编码,以实现这些多个矩形作为表格布局。我可以编写一个非常糟糕的矩阵,但是我如何使用HTML和CSS实现下面的设计,我知道这非常简单,但我不确定如何正确地实现

.flex-container {
padding: 0;
margin: 0;
list-style: none;
max-height: 600px;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-flow: column wrap;
justify-content: space-around;
flex-direction: column;
}
.flex-item {
display: flex;
}
.ex-col {
width: 100%;
max-width: 420px;
background: white;
padding: 20px;
color: #555;
}
.ex-col h2 {
font-size: 1.1em;
line-height: 1.3em;
text-align: center;
font-weight: bold;
margin: 0 0 10px;
padding: 0 0 10px;
border-bottom: 1px solid slategray;
width: 100%;
font-weight: bold;
}
.ex-col h2>small {
display: block;
font-size: .9rem;
line-height: 1.3rem;
font-weight: normal;
}
.ex-list {
list-style: none;
padding: 0;
margin: 0;
display: grid;
grid-gap: 10px;
}
/* The list item element. Must be FLEX */
.ex-list>li {
display: flex;
align-items: center;
min-height: 70px;
}
/* The list heading element */
.ex-list h3 {
font-size: 1em;
line-height: 1.4em;
padding: 6px 8px;
border: 1px solid slategray;
display: flex;
align-items: center;
/* Set flex size to 50% of the parent element width.
This is a good way to make sure it is always 50% */
flex-basis: 100%;
max-width: 50%;
cursor: pointer;
margin: 0;
}
.ex-list h3>small {
font-size: .6em;
line-height: 1em;
color: lightgray;
margin: 0 0 0 .5em;
}
/* The sub-menu element. Initial state is display:none */
.ex-list-sub {
display: none;
list-style: none;
padding: 0 0 0 20px;
margin: 0;
position: relative;
flex-basis: 100%;
max-width: 50%;
transition: opacity .4s ease-out;
border: 1px solid gray;
border-left: none;
}
.ex-list-sub:before {
content: "";
display: block;
position: absolute;
top: 0;
bottom: 0;
left: 0;
width: 20px;
background: gray;
}
.ex-list-sub>li:not(:first-child) {
border-top: 1px solid gray;
}
.ex-list-sub>li>a {
display: block;
padding: 6px 8px;
color: inherit;
text-decoration: none;
transition: background .2s;
}
.ex-list-sub>li>a:hover {
background: #efefef;
}
/* THE HOVER ACTION */
/* Set the hover on the parent element.
Has to be the parent because otherwise the pop-up would disappear when you hover over it */
.ex-list>li:hover .ex-list-sub {
display: block;
}<div class="flex-container">
<div class="flex-item">
<div class="ex-col">
<h2>
Reconnaissance
<small>10 Techniques</small>
</h2>
<ul class="ex-list">
<li>
<h3>
Active Scanning
<small>(0/2)</small>
</h3>
<ul class="ex-list-sub">
<li>
<a href="#">
Scanning IP Blocks
</a>
</li>
<li>
<a href="#">
Vulnerability Scanning
</a>
</li>
</ul>
</li>
</ul>
</div>
<div class="ex-col">
<h2>
Reconnaissance
<small>10 Techniques</small>
</h2>
<ul class="ex-list">
<li>
<h3>
Active Scanning
<small>(0/2)</small>
</h3>
<ul class="ex-list-sub">
<li>
<a href="#">
Scanning IP Blocks
</a>
</li>
<li>
<a href="#">
Vulnerability Scanning
</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
发布于 2021-02-18 13:57:45
也许是这样的东西?我从你的截图中复制的,有遗漏什么吗?
.column{
float:left;
margin:0 10px 0 0;
width:120px;
}
.column .option{
margin:10px 0 0 0;
padding:10px;
background:grey;
}
.column .option:first-child{
background:tomato;
}<div class="column">
<div class="option">Some text here</div>
<div class="option">Some text here</div>
<div class="option">Some text here</div>
<div class="option">Some text here</div>
</div>
<div class="column">
<div class="option">Some text here</div>
<div class="option">Some text here</div>
</div>
<div class="column">
<div class="option">Some text here</div>
<div class="option">Some text here</div>
<div class="option">Some text here</div>
<div class="option">Some text here</div>
<div class="option">Some text here</div>
<div class="option">Some text here</div>
<div class="option">Some text here</div>
</div>
https://stackoverflow.com/questions/66253985
复制相似问题