html - 如何在此标题中添加两个图像?
问题描述
我有一个看起来像这样的标题。现在我想在标题右侧添加图像,作为联系人和帮助链接按钮。
我怎样才能做到这一点?
#header {
position: absolute;
top: 0px;
height: 40px;
color: #eee;
background: linear-gradient(#fff, #e3e3e3);
width: 100%;
}
#header img {
float: left;
margin-top: 14px;
margin-left: 10px;
width: 142px;
height: 12px;
}
和
<div id="header">
<img src="logo.png" alt="logo" />
</div>
解决方案
如果您希望第二张图像右对齐。
<img>
我在原始元素下方添加了一个新元素,并为它们分配了一个 id。即logo1和logo2。
#header {
position: absolute;
top: 0px;
height: 40px;
color: #eee;
background: linear-gradient(#fff, #e3e3e3);
width: 100%;
}
#header img,
#logo1 {
float: left;
margin-top: 14px;
margin-left: 10px;
width: 142px;
height: 12px;
}
#header #logo2 {
float: right;
}
<div id="header">
<img id="logo1" src="logo.png" alt="logo" />
<img id="logo2" src="logo2.png" alt="logo" />
</div>
推荐阅读
- r - 如何在数学上转换 ggplot 中图例上的默认标签?
- java - 使用 JAR 中的文件,同时从 jar 中运行应用程序
- amazon-s3 - s3 presinged url nginx反向代理错误 - SignatureDoesNotMatch
- android - 在已编译的应用程序中运行 Flutter builder runner
- python - X.shape[1] 大小不符合预期值
- django - 通过分组在Django中显示数据
- azure - OAuth 同意表单是否需要 Azure 的 User.Read 权限?
- google-api - Google Admin SDK:报告 API 活动:观看 > 发送相同通知的音调
- amazon-web-services - 如何在 cloudformation lambda 中为 aws lambda 设置 maximumRetryAttempt?
- java - JavaFX 在 KeyHandlers 中添加 KeyFrames