gpt4 book ai didi

HTML 样式化用户行

转载 作者:行者123 更新时间:2023-12-04 03:51:18 26 4
gpt4 key购买 nike

当我尝试设置我设计的行的样式时,我遇到了一些问题。该行应如下所示: enter image description here

现在我已经很远了,但是一行的内容都在彼此的下面。我已经更改为 CSS 网格,但这就是我遇到这个问题的原因!

这是我当前代码的片段:

.user-part {
width: 100%;
padding-top: 20px;
}

.user-part .list {
width: 100%;
}

.user-part .list .seperation-line {
width: 100%;
background-color: #C4C4C4;
height: 2px;
padding: 0px;
}


.user-part .list .list-header {
display: inline-block;
padding-top: 30px;
padding-bottom: 10px;
}

.user-part .list .list-header .grid-container {
display: grid;
grid-template-columns: 5% auto auto auto auto 10% auto;
grid-gap: 10px;
}

.user-part .list .list-header .grid-container > div {
text-align: left;
padding: 20px 0;
font-size: 18px;
font-weight: bold;
}

.user-part .list .list-user {
display: inline-block;
padding-top: 10px;
padding-bottom: 10px;
}

.user-part .list .list-user span {
font-size: 18px;
width: 100%;
}

/*---Toggle switch---*/
.switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
}

.switch input {
opacity: 0;
width: 0;
height: 0;
}

.switch .slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}

.switch .slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}

.switch input:checked + .slider {
background-color: #48CE19;
}

.switch input:focus + .slider {
box-shadow: 0 0 1px #48CE19;
}

.switch input:checked + .slider:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
}

.switch .slider.round {
border-radius: 34px;
}

.switch .slider.round:before {
border-radius: 50%;
}
/*--------------------*/
<div class="user-part">
<div class="list">
<div class="list-header">
<div class="grid-container">
<div>
<span>Id</span>
</div>
<div>
<span>Naam</span>
</div>
<div>
<span>Email</span>
</div>
<div>
<span>Laatste login</span>
</div>
<div>
<span>Gerapporteerd</span>
</div>
<div>
<span>Actief</span>
</div>
<div>
</div>
</div>
</div>

<div class="seperation-line"></div>

<div class="list-user">
<div class="grid-container">
<div>
<span>266</span>
</div>
<div>
<span>Alexander Vreeswijk</span>
</div>
<div>
<span>alexander@vreeswijk.eu</span>
</div>
<div>
<span>2020-10-05 16:22</span>
</div>
<div>
<span>0</span>
</div>
<div>
<label class="switch">
<input type="checkbox" checked>
<span class="slider round"></span>
</label>
</div>
<div>
<a href=""><img src="images/EditUser.png" /></a>
<a href=""><img src="images/DeleteUser.png" /></a>
</div>
</div>
</div>

<div class="seperation-line"></div>

</div>
</div>

一行的内容都在下面,我该如何解决?

最佳答案

对您的代码进行一些调整的实例:

.user-part {
width: 100%;
padding-top: 20px;
padding-top: 30px;
}

.user-part .list {
width: 100%;
text-align: center;
}

.list-user {
width: 100%;
line-height: 42px;
}

.user-part .list .seperation-line {
width: 100%;
height: 2px;
padding: 0px;
background-color: #C4C4C4;
}

.user-part .list .list-header {
width: 100%;
padding-bottom: 10px;
display: inline-block;
}

.user-part .list .list-header span {
width: 100%;
font-size: 16px;
font-weight: bold;
}

.user-part .list .list-header .header-id {
width: 8%;
display: inline-block;
}

.user-part .list .list-header .header-name {
width: 16%;
display: inline-block;
}

.user-part .list .list-header .header-email {
width: 20%;
display: inline-block;
}

.user-part .list .list-header .header-lastlogin {
width: 13%;
display: inline-block;
}

.user-part .list .list-header .header-reported {
width: 13%;
display: inline-block;
}

.user-part .list .list-header .header-active {
width: 13%;
text-align: center;
display: inline-block;
}

.user-part .list .list-header .header-buttons {
width: 13%;
display: inline-block;
}

.user-part .list .list-user {
padding-top: 10px;
padding-bottom: 10px;
display: inline-block;
}

.user-part .list .list-user span {
width: 100%;
font-size: 13px;
}

.user-part .list .list-user .user-id {
width: 8%;
display: inline-block;
}

.user-part .list .list-user .user-name {
width: 16%;
display: inline-block;
}

.user-part .list .list-user .user-email {
width: 20%;
display: inline-block;
}

.user-part .list .list-user .user-lastlogin {
width: 13%;
display: inline-block;
}

.user-part .list .list-user .user-reported {
width: 13%;
text-align: center;
display: inline-block;
}

.user-part .list .list-user .user-active {
width: 13%;
text-align: center;
display: inline-block;
}

.user-part .list .list-user .user-buttons {
width: 13%;
text-align: center;
display: inline-block;
}

.user-part .list .list-user .user-buttons a {
padding: 5px;
}


/*---Toggle switch---*/

.user-part .list .list-user .user-active .switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
}

.user-part .list .list-user .user-active .switch input {
opacity: 0;
width: 0;
height: 0;
}

.user-part .list .list-user .user-active .switch .slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}

.user-part .list .list-user .user-active .switch .slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}

.user-part .list .list-user .user-active .switch input:checked+.slider {
background-color: #2196F3;
}

.user-part .list .list-user .user-active .switch input:focus+.slider {
box-shadow: 0 0 1px #2196F3;
}

.user-part .list .list-user .user-active .switch input:checked+.slider:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
}

.user-part .list .list-user .user-active .switch .slider.round {
border-radius: 34px;
}

.user-part .list .list-user .user-active .switch .slider.round:before {
border-radius: 50%;
}
<div class="user-part">

<div class="list">

<div class="list-header">
<div class="header-id"><span>Id</span></div>
<div class="header-name"><span>Naam</span></div>
<div class="header-email"><span>Email</span></div>
<div class="header-lastlogin"><span>Laatste login</span></div>
<div class="header-reported"><span>Gerapporteerd</span></div>
<div class="header-active"><span>Actief</span></div>
<div class="header-buttons"></div>
</div>

<div class="seperation-line"></div>

<div class="list-user">

<div class="user-id">
<span>266</span>
</div>

<div class="user-name">
<span>Alexander Vreeswijk</span>
</div>

<div class="user-email">
<span>alexander@vreeswijk.eu</span>
</div>

<div class="user-lastlogin">
<span>2020-10-05 16:22</span>
</div>

<div class="user-reported">
<span>0</span>
</div>

<div class="user-active">
<label class="switch">
<input type="checkbox" checked>
<span class="slider round"></span>
</label>
</div>

<div class="user-buttons">
<a href=""><img src="images/EditUser.png" /></a>
<a href=""><img src="images/DeleteUser.png" /></a>
</div>
</div>
<div class="seperation-line"></div>
</div>
</div>

关于HTML 样式化用户行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64402382/

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