html 清除flex,html – 如何防止flex div的内容增加flex的宽度?

正如我在

fiddle评论中发布的那样,我使用了静态最大宽度,因为我相信这是一个很好的解决方案.

CSS

html,body {

direction: rtl;

font-family: 'Times New Roman';

}

.WholeDiv{

margin-right: 20px;

margin-left: 20px;

background-color: #ffffff;

border: 2px solid #e8e8e8;

}

.mainContainer{

display: -webkit-box;

display: -moz-box;

display: -ms-flexbox;

display: -webkit-flex;

display: flex;

-webkit-box-direction: normal;

-moz-box-direction: normal;

-ms-flex-direction: row;

-webkit-flex-direction: row;

flex-direction: row;

background-color: blue;

min-width: 512px;

height: 232px;

line-height: 232px;

z-index: 999;

text-align: center;

top: 0px;

width: 100%;

}

.mainContainer .firstContent {

flex: 1 1 auto;

background: green;

overflow: hidden;

min-width: 140px;

text-align: right;

}

.mainContainer .secondContent {

width: 232px;

min-width: 232px;

background-color: aqua;

}

.mainContainer .thirdContent {

flex: 1 1 auto;

background-color: red;

overflow: hidden;

min-width: 140px;

text-align: left;

}

.mainContainerVert{

display: -webkit-box;

display: -moz-box;

display: -ms-flexbox;

display: -webkit-flex;

display: flex;

-webkit-box-orient: vertical;

-moz-box-orient: vertical;

-ms-flex-direction: column;

-webkit-flex-direction: column;

flex-direction: column;

-webkit-box-align: center;

-moz-box-align: center;

-ms-flex-align: center;

-webkit-align-items: center;

align-items: center;

-webkit-box-pack: space-around;

-moz-box-pack: space-around;

-ms-flex-pack: space-around;

-webkit-justify-content: space-around;

justify-content: space-around;

-webkit-flex-flow: column no-wrap;

flex-flow: column no-wrap;

-webkit-align-content: center;

align-content: center;

background-color: blue;

/*min-width: 100px;*/

height: 232px;

line-height: 232px;

text-align: center;

max-width: 100%;

}

.mainContainerVert .dvRow{

flex: 1 1 auto;

background-color: black;

color: white;

height: 32px;

line-height: 32px;

max-height: 32px;

width: 98%;

max-width: 300px;

/*min-width: 100px;*/

text-align: center;

white-space:nowrap;

display: flex;

}

SPAN{

/*flex: 1 1 auto;*/

background-color: orange;

text-align: center;

text-overflow: ellipsis;

width: 300px;

max-width: 300px;

/*min-width: 100px;*/

overflow: hidden;

/*white-space: no-wrap;*/

margin: 0 auto;

}

fiddle

同时从span flex中删除:1 1 auto;.我认为没有必要.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值