Giter VIP home page Giter VIP logo

inbox's Introduction

About

这个仓库是网上看到的一些前端的小技巧的实践集合

1. H5 唤起本地app

通过url scheme 唤起本地app. 常用的 URL scheme: https://github.com/dzlixu/Inbox/blob/master/doc/1.md

demo: https://github.com/dzlixu/Inbox/blob/master/src/1.html

2.你写的 height:100% 不起作用

Web浏览器在计算有效宽度时会考虑浏览器窗口的打开宽度。我们不设置宽,会自动填满整个横向宽度. 但是高度的计算方式完全不一样。事实上,浏览器根本就不计算内容的高度,除非内容超出了视窗范围(导致滚动条出现)。或者你给整个页面设置一个绝对高度。否则,浏览器就会简单的让内容往下堆砌,页面的高度根本就无需考虑。

因为页面并没有缺省的高度值,所以,当你让一个元素的高度设定为百分比高度时,无法根据获取父元素的高度,也就无法计算自己的高度。

即父元素的高度只是一个缺省值:height: auto;我们设置height:100%时,是要求浏览器根据这样一个缺省值来计算百分比高度时,只能得到undefined的结果。也就是一个null值,浏览器不会对这个值有任何的反应。

解决:只要给父元素设置高度就行了。

line-hieght 居中 代码如设置了line-height为100%没有居中,这是因为line-hieght的%是相对于字体尺寸的,所以直接作用于没有绝对高度的元素是不行的。 demo: https://github.com/dzlixu/Inbox/blob/master/src/2.html

inbox's People

Contributors

dzlixu avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.