gpt4 book ai didi

javascript - CSS如何删除右边、左边和底部的空格

转载 作者:行者123 更新时间:2023-11-28 05:16:15 26 4
gpt4 key购买 nike

我有一些 slider 代码。一切正常。但是我需要删除指针和页面右侧(或左侧)之间的两个(右侧和左侧)部分的空白。

[class^="scroll"] {
position: absolute;
top: 62%;
height: 38%;
line-height: 10em;
padding: 0 3em;
}
[class^="scroll"] input {
display: none;
}
[class^="scroll"] div {
height: 100%;
overflow: hidden;
white-space: nowrap;
word-wrap: normal;
font-size: 0;
}
[class^="scroll"] img {
position: relative;
right: 0em;
width: 15.5%;
height: 100%;
transition: .5s;
}

[class^="scroll"] label {
cursor: pointer;
font-weight: 600;
font-size: 3em;
}
[class^="scroll"] input:nth-of-type(1):checked ~ label:nth-of-type(2):after,
[class^="scroll"] input:nth-of-type(2):checked ~ label:nth-of-type(3):after,
[class^="scroll"] input:nth-of-type(3):checked ~ label:nth-of-type(4):after,
[class^="scroll"] input:nth-of-type(4):checked ~ label:nth-of-type(5):after,
[class^="scroll"] input:nth-of-type(5):checked ~ label:nth-of-type(6):after,
[class^="scroll"] input:nth-of-type(6):checked ~ label:nth-of-type(7):after {
content: "\3009";
position: absolute;
right: 0;
}
[class^="scroll"] input:nth-of-type(2):checked ~ label:nth-of-type(1):after,
[class^="scroll"] input:nth-of-type(3):checked ~ label:nth-of-type(2):after,
[class^="scroll"] input:nth-of-type(4):checked ~ label:nth-of-type(3):after,
[class^="scroll"] input:nth-of-type(5):checked ~ label:nth-of-type(4):after,
[class^="scroll"] input:nth-of-type(6):checked ~ label:nth-of-type(5):after,
[class^="scroll"] input:nth-of-type(7):checked ~ label:nth-of-type(6):after {
content: "\3008";
position: absolute;
left: 0;
}

[class^="scroll"] input:nth-of-type(2):checked ~ div img {right: 25%;}
[class^="scroll"] input:nth-of-type(3):checked ~ div img {right: 50%;}
[class^="scroll"] input:nth-of-type(4):checked ~ div img {right: 75%;}
[class^="scroll"] input:nth-of-type(5):checked ~ div img {right: 100%;}
[class^="scroll"] input:nth-of-type(6):checked ~ div img {right: 125%;}
[class^="scroll"] input:nth-of-type(7):checked ~ div img {right: 150%;}
<div class="scroll">
<input type="radio" id="l0" name="raz" checked="checked"/>
<input type="radio" id="l1" name="raz"/>
<input type="radio" id="l2" name="raz"/>
<input type="radio" id="l3" name="raz"/>
<input type="radio" id="l4" name="raz"/>
<input type="radio" id="l5" name="raz"/>
<input type="radio" id="l6" name="raz"/>

<label for="l0"></label>
<label for="l1"></label>
<label for="l2"></label>
<label for="l3"></label>
<label for="l4"></label>
<label for="l5"></label>
<label for="l6"></label>

<div>
<img src="1.jpg" alt=""/>
<img src="2.jpg" alt=""/>
<img src="3.jpg" alt=""/>
<img src="4.jpg" alt=""/>
<img src="5.jpg" alt=""/>
<img src="6.jpg" alt=""/>
<img src="7.jpg" alt=""/>
<img src="8.jpg" alt=""/>

<img src="10.jpg" alt=""/>
<img src="9.jpg" alt=""/>
<img src="11.jpg" alt=""/>
<img src="12.jpg" alt=""/>
<img src="13.jpg" alt=""/>
<img src="20.jpg" alt=""/>
<img src="21.jpg" alt=""/>
<img src="23.jpg" alt=""/>
</div>
</div>

我已经尝试了不同的填充、边距,但没有解决。谁能帮帮我?

最佳答案

如果我正确理解了你的问题(我认为你只是想删除边距),你必须将以下属性添加到具有 scroll 类的元素:

right: 0; 
left: 0;

这意味着您的代码段的第一个 block 将如下所示:

[class^="scroll"] {
position: absolute;
top: 62%;
right: 0; // tell the absolute element to have 0 space on the right
left: 0; // tell the absolute element to have 0 space on the left

height: 38%;
line-height: 10em;
padding: 0 3em;
}

关于javascript - CSS如何删除右边、左边和底部的空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39296872/

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