双飞翼布局,中间列文字不换行,是什么原理呢?

来源:3-8 布局-解题-4

躲躲藏藏

2020-11-28

图片描述

老师这个是什么原理呢, 为什么 wrap 的文字只显示一行呢。

<style>
.center{
         width: 100%;
         background: red;
     }
     .wrap{
        margin: 0 200px;
     }

     .left{
           width: 200px;
           background: brown;
           margin-left: -100%;
     }
     .right{
           width: 200px;
           background: burlywood;
           margin-left: -200px;
     }
     .column{float: left;}
    .box{overflow: hidden;}
</style>

<div class="box">
       <div class="center column">
           <div class="wrap">121212112121212211212121212211212121212211212121212211212121212211212121212211212121212211212121212211212121212211212121212211212121212211212121212211212121212211212121212211212121212211212121212211212121212211212121212211212121212211212121212211212121212211212121212211212121212211212121212211212121212211212121212211212121212211212121212211212121212211212121221121212121221121212121221121212121221121212121221121212121221121212121221121212121221121212121221121212121221121212121212211212121212211212121212211212121212211212121212211212121212211222112121212122112121212122112121212122112121212122112</div>
       </div>
       <div class="left column">this is left</div>
       <div class="right column">this is right</div>
   </div>
写回答

1回答

双越

2020-11-28

正常写汉字、或者正常的英文(单词之间有空格的),就可以正常换行了。

如果是连续的英文或者数字,浏览器会以为这是一个很长的单词,默认是不会换行的。

0
1
躲躲藏藏
非常感谢!
2020-12-01
共1条回复

一天时间高效准备前端技术一面 匹配大厂面试要求

针对时下面试高频考点,帮助新人js面试快速通关

4694 学习 · 1681 问题

查看课程