gpt4 book ai didi

html - 保持段落标签中的多行均匀对齐

转载 作者:太空宇宙 更新时间:2023-11-04 00:55:10 24 4
gpt4 key购买 nike

th {
background-color: #d7d7d7;
color: white;
font-family: 'Tw Cen MT';
font-weight: normal;
font-size: 24px;
padding: 25px;
border-style: solid;
height: 300px;
width: 250px;
text-align: left;
bottom: auto;
right: auto;
left: auto;
vertical-align: top;
border-left: 14px solid white;
border-right: 15px solid white;
/*AVOIDS TEXT FROM GETTING UNDER BULLET ICON */
padding-left: 53px;
text-indent: -33px;
}


/*KEEPS THE TEXT IN LINE */

.test {
margin: auto;
cursor: pointer;
}

p {
margin: auto;
}

.underline_hover:hover {
text-decoration: underline;
}
<table>
<tbody>
<tr>

<th><span class="test" style="color: black;">

<!-- Heading #1 of the Column-->
<p style="text-align: left;"><strong>Header works fine</strong></p>

<!-- Bulleted points of the Column-->
<li onclick="location.href = '#';"><span class="underline_hover">Bullet #1</span></li>

<br>

<!-- Heading #2 of the Column-->
<p style="text-align: left;"><strong>This is the header that is causing problems in smaller displays </strong></p>


<li onclick="location.href = '#';"><span class="underline_hover">Bullet #2</span></li>


</span>
</th>

</tr>
</tbody>
</table>

嘿 StackOverflow 社区!我一直在设计表格布局,但遇到了一个问题。 <p>标签包含我的表的标题。

对于标题文本:在较小的显示中,第一行之后的行与第一行中设置的对齐方式对齐。我已尽力解决此问题,但每次都失败了。此处的任何帮助将不胜感激。

谢谢

最佳答案

如果您正在寻找只有一列的表格,我会将您的 HTML 更改为更像这样的内容:

<table>
<tbody>
<tr>

<!-- Heading #1 of the Column-->
<h2>Header works fine</h2>

<!-- Bulleted points of the Column-->
<ul>
<li><a href="#">Bullet</a></li>
</ul>

</tr>
<tr>

<!-- Heading #2 of the Column-->
<h2>Header that is causing problems</h2>

<!-- Bulleted points of the Column-->
<ul>
<li><a href="#">Bullet</a></li>
</ul>

</tr>
</tbody>
</table>

然后将您的 CSS 简化为:

table {
background-color: #d7d7d7;
font-family: 'Tw Cen MT';
border: 14px solid #ffffff;
padding: 25px;
}

关于html - 保持段落标签中的多行均匀对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54949787/

24 4 0