【发布时间】:2016-06-24 01:33:16
【问题描述】:
假设我有这样的情况:
您可以看到几个主要部分:
- 面板(红色边框)
- 图片
- 徽标
- 标题
我需要这个设置:
所以徽标需要起床。通常,每次我尝试制作图像absolute 和徽标relative,然后将其浮动到右侧它就可以了,但是我失去了也位于图像下方的标题。
而且我不能使标题相对并以某种价值从顶部推送它,因为图像是响应式的并且将其更改为height。
这是我正在使用的代码。
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<style>
.body {
width: 100%;
}
.panel {
border: 1px solid red;
background-color: blue;
margin: 50px;
}
img {
width: 100%;
}
.logo {
background-color: red;
border: 1px solid yellow;
width: 100px;
}
</style>
</head>
<body>
<div class="panel">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTVxPtnNvc1ZwknRSdJZIPjrmUHitXdUU_-TT3wuIF-mWND6sXV" class="img-responsive" alt="picture nature">
<div class="logo">
I'm a logo
</div>
<h1>I'm a title, hello</h1>
</div>
</body>
</html>
【问题讨论】:
-
请检查此网址。 codepen.io/nehemc/pen/YWpmMb
标签: html css twitter-bootstrap css-position responsive-images