Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div style="width:150px;height:50px;float:left">
        <div id="textInfos" style="
  overflow : hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;">
            脫離文件流:就不佔據空間了? 是的,一個元素脫離文件流後,其他的元素在定位時候回當做沒看見他,兩者位置

            重疊都是可以的。 2、脫離文件流不是從dom樹中脫離,用瀏覽器的審查元素可以看到脫離文件流的元素,依然會

            出現在dom樹裡 3、實質: 脫離文件流,也就是將元素從普通的佈局排版中拿走,其他盒子在定位的時候,會

            當做脫離文件流的元素不存在而進行定位。需要注意的是,使用float脫離文件流時,其他盒子會無視這個元素,

            但其他盒子內的文字依然會為這個元素讓出位置,環繞在周圍。而對於使用absolute positioning脫離文件流的

            元素,其他盒子與其他盒子內的文字都會無視它。
        </div>
    </div>
    <div style="float:left;padding:20px 5px">
        <a href="#" id="showText">顯示更多</a>
    </div>
    <div style="clear: both;"></div>
    <div class="aa"></div>

              
            
!

CSS

              
                .aa{
            width: 100%;
            height: 100px;
            background: #000;
        }
              
            
!

JS

              
                 var isShow = false
        document.getElementById('showText').onclick = function() {
            if (isShow) {
                isShow = false
                this.value = "顯示更多"
                document.getElementById('textInfos').style.display = "-webkit-box"
            } else {
                isShow = true
                this.value = "隱藏"
                document.getElementById('textInfos').style.display = ""
            }
        }
              
            
!
999px

Console