html中内容大小变化,纯css实现内容根据容器的宽度的改变而改变

html {

width:100vw;

height:100vh;

}

body {

width:100vw;

height:100vh;

justify-content:center;

font:23px/36px '21Cent-Regular',Georgia,serif,Helvetica Neue,Arial;

font-feature-settings:"lnum" 0,"onum";

-webkit-font-smoothing:subpixel-antialiased;

text-rendering:optimizelegibility;

}

.demo {

margin-top:18px;

box-sizing:border-box;

text-align:left;

width:756px;

max-width:100%;

overflow:visible;

position:relative;

cursor:text;

padding:50px;

}

.example > input {

vertical-align:middle;

margin:-0.2em 0 0;

cursor:pointer;

}

.example > label {

cursor:pointer;

}

.wrapper {

resize:horizontal;

overflow:hidden;

box-sizing:border-box;

width:100%;

padding:0.5em 1em;

border:1px solid;

transition:width 1.5s;

margin-top:10px;

}

.heading {

margin:0;

text-align:center;

line-height:1;

word-wrap:break-word;

-webkit-font-smoothing:antialiased;

-moz-osx-font-smoothing:grayscale;

}

.menu {

display:flex;

margin:0;

padding:0;

justify-content:space-around;

}

.menu-item {

flex-shrink:1;

overflow:hidden;

min-width:2em;

padding:0 0.5em;

text-align:center;

text-shadow:0 1px #FFF;

margin:0;

}

.menu-item:before {

display:none;

}

.menu-item a {

padding:.3em 0 .287em;

cursor:pointer;

color:#0985ce;

text-decoration:none;

}

.menu-item a:hover {

color:#8c64b4;

}

.overflower {

display:inline-flex;

flex-wrap:wrap;

overflow:hidden;

box-sizing:border-box;

max-width:100%;

height:1.5em;

line-height:1.5em;

white-space:nowrap;

text-overflow:ellipsis;

}

.overflower-short {

display:block;

overflow:hidden;

flex-grow:1;

width:0;

text-overflow:ellipsis;

}

.overflower-long {

flex-basis:100%;

display:inline;

}

[overflower-text]:after {

content:attr(overflower-text);

}

:checked + label + .wrapper {

width:30% !important;

}

.overflower {

line-height:1.5em;

display:inline-block;

overflow:hidden;

box-sizing:border-box;

max-width:100%;

height:1.5em;

white-space:nowrap;

text-overflow:ellipsis;

}

.overflower-long {

display:inline;

}

.overflower-short {

display:none;

}

@supports (flex-wrap:wrap) {

.overflower {

display:inline-flex;

flex-wrap:wrap;

}

.overflower-short {

display:block;

overflow:hidden;

width:0;

text-overflow:ellipsis;

flex-grow:1;

}

.overflower-long {

flex-basis:100%;

}

}

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值