Html 如何在html的href中添加垂直文本对齐?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10810371/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to add vertical text align in href in html?
提问by user1324068
Hai i have a list(dynamically i created the html),in that list i added many hyperlinks .Now i want to add that link in center how to do this?kindly help me
海我有一个列表(我动态创建了 html),在该列表中我添加了许多超链接。现在我想在中心添加该链接如何做到这一点?请帮助我
"<FONT SIZE=5;face=Droid Sans>"+"<p style=text-align:center>"+"<a id='"+i+"' href='#' >" +value + "</a>"+"</p>"+"<hr style='border:1px solid #EBEBEB'/>"+"</FONT>"+ "</li>");
回答by palAlaa
Try to use embed of external style not inline style. I used line-height
to make vertical align and text-align: center
to center the text.
尝试使用嵌入的外部样式而不是内联样式。我曾经line-height
使垂直对齐并使text-align: center
文本居中。
An example of adding vertical align to anchor:
将垂直对齐添加到锚点的示例:
.anch{
font-size:12px;
color:green;
display:inline-block;
height:100px;
width:300px;
border:1px solid black;
text-align:center;
vertical-align:top;
line-height:100px;
}
<a href="#" class="anch">Anchor</a>
回答by Shailender Arora
Hi you can give vertical text in href in HTMLthrough easy css like this:-
嗨,您可以通过简单的 css在HTML中的 href 中提供垂直文本,如下所示:-
<a href="#" style="width:200px; height:100px; background:red; display:table-cell; vertical-align:middle; text-align:center; color:black;">shailender</a>
i hope this can be helpful for you.....
我希望这对你有帮助......
or see the demo:- http://jsbin.com/uwemuy/edit#html,live