在一系列内联元素中缩小中间div的宽度

时间:2015-06-12 14:39:29

标签: html css

我的布局中有以下内联元素排列:

***********************************************
*     Div 1      *       Div 2       * Button *
* Dynamic text   *  Some static text *        *  
***********************************************

我的问题是,当div 1内的内容很长时,按钮就不合适了。

******************************************
*     Div 1           *    Div 2         *         
* A long dynamic text * Some static text *********** 
*                     *                 *  Button *  
****************************************************

欲望效果是缩小Div 2的宽度并使文本分成两行。

***********************************************
*     Div 1           *    Div 2     *        *
* A long dynamic text *  Some long   * Button *
*                     *  static text *        *  
***********************************************

我该怎么做呢?谢谢!

1 个答案:

答案 0 :(得分:0)

将所有3 div放入包装中。制作包装器position: relative。然后使用按钮div进行height: 100%