我有以下 HTML:
<!DOCTYPE html>
<HTML>
<HEAD>
<style type="text/css">
.name {
font-size: 18px;
margin-top: 1px;
text-align: right;
}
.contactInfo {
font-size: 12px;
margin-top: 1px;
text-align: left;
}
</style>
<TITLE>Joe Sixpack</TITLE>
</HEAD>
<BODY>
<div id="name">
<span class="name">Joe Sixpack</span>
</div>
<div id="contactInfo">
<span class="contactInfo">
123 Electric Ave, Mudflap, NS 12345 • (888) 555-1212 • <A HREF="mailto:Joe@Sixpack.com">Joe@Sixpack.com</A>
</span>
</div>
<HR>
</BODY>
</HTML>
问题是我希望名称类与右侧对齐,但它没有发生。名字和地址都在左边。为什么会这样,我该如何解决?