将div-box放在右上角的较大div框中

时间:2014-10-01 14:14:31

标签: html5 css3 layout

是否有可能在右上角放置一个较小的div-box? 那么在更大的div中仍然可以有文本,在较小的div左侧?

|----------------------------|
| Random text      |------|  |
|                  |blabl |  |
|                  |------|  |
|                            |
|                            |
|----------------------------|

由于

1 个答案:

答案 0 :(得分:1)

尝试这样的事情。

.big-box{
  border:1px solid red;
  overflow:hidden;
  padding:10px;
}
.small-box{
  border:1px solid green;
  padding:10px;
  float:right;  
}
<div class="big-box">
  <div class="small-box">
    contents of small box
  </div>
  Contents of big box.<br/>
  multiple lines<br/>
  multiple lines<br/>
  multiple lines<br/>
  multiple lines<br/>
</div>