我正在努力把一个个人网站放在一起,但是我现在被困在试图将我的社交媒体图标定位在我的头上。看下面我有什么自动取款机:

文本和facebook图标是沿着我的标题底部对齐的,但是我希望将文本放在标题的中间,图标的顶部和底部之间的空间是相同的,这样它就会出现在中心。有人能帮我吗?
谢谢
忘记添加代码,目前有点混乱:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
<title> Chilun</title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
<style type="text/css">
@font-face /* support for browsers & IE v10 onwards*/
{font-family:homefont; src: url("Juice.ttf");}
{font-family:headerfont; src: url("playball.ttf");}
body {background:url('img/mybackground1.jpg') no-repeat center center fixed;}
<!-- Make Header Sticky -->
#header_container {background:#00E5EE; border:0px solid #666; height:60px; left:0; position:fixed; width:100%; top:0;}
#header{line-height:60px; margin:0 auto; width:940px; text-align:center;display:inline-block; float:right; padding:15px;}
#wrapper{width:900px;margin:0 auto;}
a{color:#444;}
.logo{margin-left:600px;margin-top:100px;background:#fff;padding:10px;}
.bigtitle{font-family: homefont; font-size:100px; color:#FF0000; text-transform:uppercase; text-align:center; margin-top:200px;}
.header{font-family: headerfont; font-size:20px; color:#FFFFFF; text-align: left; font-style:italic;}
</style>
</head>
<body>
<div id="header_container">
<div id="header"><p class="header"> Follow me on: <a style="padding:5; margin:0; href="https://www.facebook.com/chilunliuTheBOSSE"; View my Facebook Profile</a><img src="/img/facebook-lnk.gif" width="40" height="40"></div></p>
</div>
<div id="wrapper">
<h1 class="bigtitle"> Chilun Liu</h1>
</div>
</body>
</html>发布于 2014-01-29 20:57:30
在css中,选择包含图标和文本(即div.facebookicon)的div,并为它们使用标准css格式( facebookicon.div {-css此处--})。使用命令文本-对齐:居中;将其横向居中。接下来,使用填充和边距(即填充:10 to;)来获得所需的垂直效果。(在标头的中间位置对齐)
编辑:我注意到你用的是文本-对齐:左;.这就是为什么它会像这样被推到左边。您还可以尝试这样的方法:
.className{
width:300px;
height:200px;
position:absolute;
left:50%;
top:50%;
margin:-100px 0 0 -150px;
}(根据具体情况进行实验)
https://stackoverflow.com/questions/21442244
复制相似问题