我是这段代码
<div class="col-md-3" style="border: solid 2px blue">
<div class="text-center" style="transform: rotate(-90deg); border: solid 2px red; height:35px;">
Some text
</div>
<div class="pull-right">
<img ng-src="/static/images/insegne/{{ insegna.id }}.jpg" style="width:120px; height:120px; border:solid 2px white;" ng-click="vm.onInsegnaClicked(insegna)" />
</div>
</div>
我的目标是让包含图像的div附近的div接近红色。我怎么能这样做?我试图在red div处添加一个左拉类,但是不起作用。
答案 0 :(得分:1)
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container-fluid">
<h1>Hello World!</h1>
<p>Resize the browser window to see the effect.</p>
<div class="row">
<div class="col-sm-6" style="background-color:lavender;">.col-sm-4</div>
<div class="col-sm-6" style="background-color:lavenderblush;">.col-sm-8</div>
</div>
</div>
</body>
</html>
我觉得你想要某种东西或者像这样的地方?全屏查看。
答案 1 :(得分:0)
将您的结构更改为这样,它将起作用。
<div class="col-md-3" style="border: solid 2px blue">
<div class="pull-right">
<img ng-src="/static/images/insegne/{{ insegna.id }}.jpg" style="width:120px; height:120px; border:solid 2px white;" ng-click="vm.onInsegnaClicked(insegna)" />
</div>
<div class="text-center pull-right" style="transform: rotate(-90deg); border: solid 2px red; height:35px;">
Some text
</div>
</div>
答案 2 :(得分:0)
我使用display flex,也没有bootstrap,这样做:
.cont{
display:flex;
}
.left .right{
flex-grow:1
}
<div class="cont" style="border: solid 2px blue;padding:20px;">
<div class="left" style="transform: rotate(-90deg); border: solid 2px red; height:35px;">
Some text
</div>
<div class="right">
<img ng-src="/static/images/insegne/{{ insegna.id }}.jpg" style="width:120px; height:120px; border:solid 2px white;" ng-click="vm.onInsegnaClicked(insegna)" />
</div>
</div>