如何在页面中心的多个面板中仅对齐两个面板的分组文本?
Posted
技术标签:
【中文标题】如何在页面中心的多个面板中仅对齐两个面板的分组文本?【英文标题】:How to align Grouping Text of only two panels out of many Panels in a page center? 【发布时间】:2017-09-09 11:00:51 【问题描述】:在我的页面中有许多面板和分组文本。对于两个面板,分组文本必须居中对齐。我试过了:
legend
margin:0 auto;
<asp:Panel ID="Panel13" runat="server" GroupingText="<b>Grouping Text</b>">
<table>
<tr></tr>
</table>
</asp:Panel>
但它会使所有面板的分组文本居中。我只需要将分组文本中心对齐到两个面板。请帮助我。
【问题讨论】:
使用text-align:center
可能吗?只是猜测,没有你的完整代码很难说。也许可以创建一个小提琴?
@indira 如何将自定义样式名称添加到要分组文本中心并应用类的元素,如下所示:.customcss legend margin:0 auto
@GurtejSingh 代码已更新
【参考方案1】:
为您希望文本居中对齐的面板指定特定类别。检查下面的示例。
legend.align-centre
text-align: center;
color: red;
legend
font-size: 16px;
padding: 15px 0;
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<legend class="align-centre">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type speci</legend>
<legend>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type speci</legend>
<legend>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type speci</legend>
<legend>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type speci</legend>
</body>
</html>
我希望这会有所帮助。
【讨论】:
以上是关于如何在页面中心的多个面板中仅对齐两个面板的分组文本?的主要内容,如果未能解决你的问题,请参考以下文章
BorderLayout.CENTER 上 GridBagLayout 面板的垂直对齐