如何对齐页面中心中许多面板中仅两个面板的分组文本?

如何对齐页面中心中许多面板中仅两个面板的分组文本?

问题描述:

在我的页面中有许多面板和分组文本。对于两个面板,分组文本必须以中心对齐。我曾尝试:如何对齐页面中心中许多面板中仅两个面板的分组文本?

legend { 
margin:0 auto; 

}

<asp:Panel ID="Panel13" runat="server" GroupingText="<b>Grouping Text</b>"> 
    <table> 
    <tr></tr> 
    </table> 
</asp:Panel> 

但它将使所有的面板中心的分组文本。我需要将分组文本中心仅对齐到两个面板。请帮助我。

+0

使用'text-align:center'也许?只是猜测,很难说没有你的完整代码。也许创造一个小提琴? –

+0

@indira如何将自定义样式名称添加到要将文本居中并应用类的元素,如下所示:'.customcss legend {margin:0 auto}' – Webruster

+0

@GurtejSingh代码已更新 –

给你希望文本对齐中心的面板提供具体的类。检查下面的例子。

legend.align-centre { 
 
    text-align: center; 
 
    color: red; 
 
} 
 

 
legend { 
 
font-size: 16px; 
 
padding: 15px 0; 
 
}
<!DOCTYPE html> 
 
<html> 
 
<head> 
 
\t <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>

我希望这有助于。