gpt4 book ai didi

自动编号前​​的 CSS 伪 - 缩进

转载 作者:太空宇宙 更新时间:2023-11-04 09:50:16 25 4
gpt4 key购买 nike

p {
counter-reset: counter;
}
p.counter {
counter-increment: counter;
padding-left: 50px;
}
p.counter:before {
position: absolute;
content: counter(counter, upper-roman)".";
left: 0;
width: 50px;
text-align: left;
}
body {
background-color: #FFFFFF;
background-image: url("background.jpg");
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
font-family: arial, helvetica, sans-serif;
font-size: 22px;
color: #808080;
}
p {
font-size: 22px;
color: #808080;
}
h1 {
font-size: 32px;
font-weight: bold;
}
h2 {
font-size: 22px;
font-weight: bold;
}
h3 {
font-size: 22px;
font-weight: normal;
text-decoration: underline;
}
hr {
border: 0;
border-bottom: 1px dashed #808080;
}
a:link {
color: #B2AB19;
text-decoration: none;
border: none;
}
a:hover {
color: inherent;
text-decoration: none;
border-bottom: 1px solid #B2AB19;
}
a:active {
color: inherent;
text-decoration: none;
border: none;
}
a:visited {
color: #B2AB19;
text-decoration: none;
border: none;
}
#container {
width: 90%;
margin: 0 auto;
background: #FFFFFF;
}
#nav {
clear: both;
width: 100%;
background-color: #FFFFFF;
border: 0px;
margin: 0 auto;
padding: 10px;
box-sizing: border-box;
}
#header {
clear: both;
width: 100%;
background-color: #FFFFFF;
border: 0px;
margin: 0 auto;
box-sizing: border-box;
}
#lcolumn {
float: left;
max-width: 250px;
border: 0px;
padding: 10px;
box-sizing: border-box;
}
#rcolumn {
position: relative;
margin-left: 250px;
border: 0px;
padding: 10px;
box-sizing: border-box;
}
#footer {
clear: both;
width: 90%;
background-color: #FFFFFF;
border: 0px;
margin: 0 auto;
text-align: center;
padding: 10px;
box-sizing: border-box;
}
<body lang="zh-hk">
<div id="container">
<div id="nav">
<a href="index.html">Contact</a>
</div>
<div id="header">
<img src="header.jpg" alt="testing" width=100% height=260>
</div>
<div id="lcolumn">
<p><a href="index.html">Chiayi</a>
</p>
<p><a href="index.html">From the Airports</a>
</p>
<p><a href="index.html">Places</a>
</p>
<p><a href="index.html">Food and Drinks</a>
</p>
<p><a href="index.html">Bike Trips</a>
</p>
</div>
<div id="rcolumn">
<h1>Reaching Chiayi City from the Airports by Public Transport</h1>
<p>Which interational airport will you arrive at?</p>
<p>&#8226; <a href="#tpe">Taiwan Taoyuan International Airport (TPE)</a>
</p>
<p>&#8226; <a href="#rmq">Taichung Airport (RMQ)</a>
</p>
<p>&#8226; <a href="#khh">Kaohsiung International Airport (KHH)</a>
</p>
<hr>
<h2 id="tpe">Taiwan Taoyuan International Airport (TPE)</h2>
<p class="counter">This is counted 1. This is counted 1. This is counted 1. This is counted 1. This is counted 1. This is counted 1. This is counted 1. This is counted 1. This is counted 1. This is counted 1. This is counted 1. This is counted 1. This is counted 1.
This is counted 1. This is counted 1.</p>
<p class="counter">This is counted 2.</p>
</div>
<div id="footer">
&#169;2016
</div>
</div>
</body>

</html>

我想在 p 中使用伪元素 :before 进行自动编号。

但是我有一些缩进问题。数字太长。从上面几行开始,它们应该左对齐。数字左边到文本开头的距离是50px。请帮忙。

最佳答案

更改或删除 width: 50px;padding-left: 50px;

段落标签的左内边距为 50px,伪元素的宽度设置为 50px。

如果您不想要那个宽度...请调整它。

关于自动编号前​​的 CSS 伪 - 缩进 <p>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39163914/

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