dpzff20644
2019-02-26 22:27
浏览 85
已采纳

CSS:在标题中垂直对齐用户个人资料图片和用户名

The header was vertically aligned before I tried including the user's profile picture, but I can't seem to get it now. After trial and error, this is what I have so far:

HTML/PHP:

<ul id="right-side">
  <li>
    <a href="">
    <img src="<?php echo $user['profile_pic'];?>" id="profilepic">
    <?php echo $user['user_name'];?>
    </a>
  </li>
</ul>

CSS:

nav {
position: fixed;
right: 0px;
top: 0px;
z-index: 1000;
background-color: rgba(0, 0, 0, 0.5);
width: 100%;
}

#right-side {
display: inline;
float: right;
text-align: right;
}

#right-side a {
vertical-align: middle;
}

#profilepic {
height:50px; 
width 50px; 
border-radius:50px;
}
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题