gpt4 book ai didi

html - 在编号元素符号和缩进文本的左侧添加边框

转载 作者:行者123 更新时间:2023-11-28 16:36:35 25 4
gpt4 key购买 nike

这是我刚刚回答的问题的后续。但是,我意识到该解决方案在我的实际代码中引起了另一个问题。

我有一个 OL 列表,其中包含编号的 LI 元素。我想在数字外部(左侧)的每个单独的 LI 元素周围放置一个左边框。我还希望这些行正确缩进,以便第 2+ 行直接出现在步骤的第 1 行下方。

这是最新的 fiddle http://jsfiddle.net/z7gkLnc7/5/

(我想保留 LI 元素周围的 div 包装器。)

<ol>
<div class = "li_wrapper">
<li>I am a line. A long line that keeps on going. It's what I do and who I am.</li>
</div>
<div class = "li_wrapper">
<li>I am a line</li>
</div>
</ol>

样式:

.li_wrapper{
font-size:20px;
margin-top:10px;
}

li{
border-left:red 2px solid;
list-style-position: inside; // Fixed border position, but how to fix indent?
}

最佳答案

像这样?

.li_wrapper{
font-size:20px;
margin-top:10px;
padding-left:30px;
border-left:2px solid red;
}
li{list-style-position: outside;}
<div><b>
I'd like for the red lines to be to the left of the numbers AND for the text to be indented.
</b>
</div><br/><br/>


<div>
Red line is, incorrectly, to the right of the number:
</div>
<ol id = "one">
<div class = "li_wrapper">
<li>I am a line. A long line that keeps on going. It's what I do and who I am.</li>
</div>
<div class = "li_wrapper">
<li>I am a line</li>
</div>
</ol>

<div>
Text is not indented:
</div>
<ol id = "two">
<div class = "li_wrapper">
<li>I am a line. A long line that keeps on going. It's what I do and who I am.</li>
</div>
<div class = "li_wrapper">
<li>I am a line</li>
</div>
</ol>

<div>
Cannot mix and match. Not right.:
</div>
<ol id = "three">
<div class = "li_wrapper">
<li>I am a line. A long line that keeps on going. It's what I do and who I am.</li>
</div>
<div class = "li_wrapper">
<li>I am a line</li>
</div>
</ol>

关于html - 在编号元素符号和缩进文本的左侧添加边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27484427/

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