imochen / hotcss Goto Github PK
View Code? Open in Web Editor NEW移动端布局终极解决方案 --- 让移动端布局开发更加容易
Home Page: http://imochen.github.io/hotcss/
移动端布局终极解决方案 --- 让移动端布局开发更加容易
Home Page: http://imochen.github.io/hotcss/
在mresize方法中,获取window.innerWidth存在兼容问题,在微信下,横向转屏,然后再转成竖向之后,获取到的值有问题。
改为如下写法没问题了:
var innerWidth = document.documentElement.clientWidth || document.body.clientWidth;
2K屏适配会出现放大的问题 (非2K屏都正常)
既然 initial-dpr=1 能避免一些bug,为什么我们不默认就设置这个呢?
px2rem.styl
px2rem( _px )
return unit(_px*320 / _designWidth /20,'rem')
我现在的项目使用的vux组件框架,webpack和vue-loader,我看hotcss的px2rem的转换公式是$px*320/$designWidth/20 + rem,和那些postcss的px2rem的插件公式都不一样。
什么方法能够解决微信长按扫描二维码?
对比了一下hotcss和淘宝的flexible,看起来最大的不同就是你们考虑了安卓的dpr(不知道对不对)。
这个在实际中没遇到什么问题么?
ios上微信会出现blink的bug
我用 postcss-px2rem remunit 设置为 37.5 即是一倍图, 在iphone6模式下, 我设置40px字体大小, 显示出来不是40px大小呀, 用flexible.js的话就是40px的
不能直接在css文件里写??
iphone6 系统更新到9.3后,用了hotcss屏幕就可以横向拖拽,就像是宽度超过100%一样
位置:
hotcss.px2rem
hotcss.rem2px
hotcss.mresize
setTimeout
同样的元素,设置字体大小,文字内容。在文字多的情况下和文字少的情况下
会出现文字大小不一致。也就是文字小的文字大小和文字多的文字大小不一致
有没有遇到一个问题,就是用hotcss,在ios下长按图片的时候有所偏移,他会跑到
<body class="body-style">
<div style="height: 200px;"></div>
<div>
<img style="width: 400px;height: 300px;" src="http://jzimg.oss-cn-shenzhen.aliyuncs.com/user-dir/Tbzd8mN8dt.JPG">
</div>
</body>
如果可以增加一个移动端的grid布局小插件一起配合使用,就更完美了。
我们公司的安卓app内置的webview当中viewport好像并没有生效,1px的线还是那么粗!尝试做了 settings.getUserAgentString();
//增加下面两行代码:
settings.setUseWideViewPort(true);
settings.setLoadWithOverviewMode(true);
但还是没有效果,请问是需要其他的什么配置吗?
你好!
想请教一下:$designWidth这个变量在scss中我不想写死,我想根据手机屏幕宽度去动态设定它,想问一下,该怎么处理?谢谢!
单位显示都正常,计算出的字体却变大了
font-size 也用 rem 的话,宽屏、窄屏上字号相差太大。
可能要根据 device-pixel-ratio 设置 body 的font-size,内容的font-size都使用 em。
跟手淘的flexible好一致。
iphone 6s 顶部fixed定位 top:0,然后内容滚动时顶部栏有很窄一条空隙。
求解答
编译平台: koala
类似margin-left: -px2rem(210); 报错
如题
想问一下,*320 和 /20
320 是ideal viewport
那 /20 代表什么呢?
请问这个 16rem
是什么意思呢?
这个 320 和 20 是根据什么来的 ?
看到js里乘以20,px2rem的css中除以20不知道这个20有什么意义吗?谢谢指教
是否考虑在库里面加上手机旋转事件,触发的话自动重新渲染
less文件编译用的是fis-parser-less,感觉px2rem.less没有起效,fis3的用户有碰到此问题的吗?
自定义name="viewport" meta无效
在hotcss.jsmeta中加入 viewport-fit=cover才行
只有 README.md 和 package.json 文件, npm官方源。
安卓系统webview打开hotcss适配的页面 发现适配失效
不设置高度字体内容会变大
有的情况下,需要让内容自动将元素的高度撑开,但是不给这个元素设定高度,元素的内容超过一行的时候 整个页面,的字体 会变大
在使用hotcss的过程中会经常输入px2rem
和data-dpr
,你感觉麻烦吗?不要紧,sublime代码片段可以帮助你。
在使用此代码片段前,请保证您的sublime已安装scss插件,插件安装方法这里就不做解释了。还不会的童鞋请点击这里
先现在这两段代码片段
打开sublime text,菜单栏找到preferences->Browse packages->user
把下载好的文件直接放进去就行了
尽情的撸码了!
同sass一样,请安装Less插件
同样下载这两段代码
打开sublime text,菜单栏找到preferences->Browse packages->user
把下载好的文件直接放进去就行了
用sublime打开这两个文件
<scope>source.scss</scope>
//把上面这段话更改为
<scope>source.less</scope>
现在发现源码里面有20和320的字样;
应该是在320px宽度的设备上1rem=20px吧
现在设备发展很快啊,我们都是具有iPhone X的375px宽度上开发的,还有我们的希望配置的1rem=50px;
配合 postcss-pxtorem
插件的rootValue
:
如下postcss.config.js
配置
const pxtorem = require('postcss-pxtorem')
module.exports = {
plugins: [
flexbugsFixes(),
autoprefixer({
flexbox: 'no-2009'
// overrideBrowserslist: ['> 1% in CN', 'android >= 4.4.4', 'ios >= 9', 'not IE 11'] // target = 'desktop'
}),
process.env.REM_ENV && pxtorem({
rootValue: pkgJSon.remUnit, // 配置自动转换的50
propList: ['*'],
mediaQuery: true
})
].filter(Boolean)
}
然后使用
<meta name="hotcss" rem-unit="50" device-width="375">
是否可以呢?
如果你这边改了我以后推广就推广你这个github,不然我自己fork改一下
才发现这个项目fork这么多,魔改的很多啊
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.