Html 通过css进行水平对齐
我试图通过CSS水平对齐一些内容Html 通过css进行水平对齐,html,css,Html,Css,我试图通过CSS水平对齐一些内容 <asp:Label ID="idWelcome" runat="server" style="position:absolute; margin-left:40%"></asp:Label> <asp:Label ID="idName" runat="server" style="position:absolute; margin-left:80%">Name</asp:Label> 名称
<asp:Label ID="idWelcome" runat="server" style="position:absolute; margin-left:40%"></asp:Label>
<asp:Label ID="idName" runat="server" style="position:absolute; margin-left:80%">Name</asp:Label>
名称
有人能告诉我应该添加什么样式,这样无论屏幕的分辨率如何,标签Welcome都会显示在右角吗 使用绝对位置:
position:absolute;
right: 0;
top: 0;
<asp:Label ID="idWelcome" runat="server" style="position:absolute; right:0"></asp:Label>
位置:绝对位置;
右:0;
排名:0;
指定元素的右
属性,该属性为位置:绝对
<asp:Label ID="idWelcome" runat="server" style="position:absolute; right:0"></asp:Label>
尝试以下代码:-
<div style="position: absolute; right: 0;">
<asp:Label ID="idWelcome" runat="server"></asp:Label>
<asp:Label ID="idName" runat="server">Name</asp:Label>
</div>
名称
如果您想在任何时候都将“欢迎…”文本放置在右上角,您必须使用CSS位置:fixed;属性,但首先用DIV将其包装,以便还包括名称,然后将DIV放置在右上角:
<div id="wrap-div">
<asp:Label ID="idWelcome" runat="server"></asp:Label>
<asp:Label ID="idName" runat="server">Name</asp:Label>
</div>
#wrap-div{
postion: fixed;
top: 0;
right: 0;
}
你怎么能拒绝投票呢?两者都有。请检查此链接:
#warp-div{
position: absolute;
top: 0;
right: 0;
}