
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
rem-responsive
Advanced tools
A JS plugin for responsive layout of web pages, used to dynamically respond to the rem units of Css on web pages
一个能在网页上使用的响应式布局的js插件,根据页面宽度动态调整页面根目录字体大小,从而实现rem单位的动态展示 A JS plugin for responsive layout of web pages, used to dynamically respond to the rem units of Css on web pages
npm i -S rem-responsive
yarn add -S rem-responsive
页面需要响应的元素使用 rem
单位,设置option.root
与设计图宽度一致时,1rem = 1px,例如:设计图元素宽度为100px,在CSS样式上直接写100rem。
// main.js
import remResponsive from 'rem-responsive'
remResponsive({
root: 750
})
需要放在 <head>
标签内,优先加载
<head>
<!-- ... -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<script src="rem-responsive.min.js"></script>
<script>
remResponsive({
root: 750
})
</script>
</head>
h1 {
width: 100rem;
margin: 0 0 20rem;
font-size: 32rem;
line-height: 1.2;
letter-spacing: 1rem;
}
Type: Object
Default:
{
max: 750, // 最大响应宽度
root: 750, // 设计稿宽度
watch: true // 是否监听页面宽度变化
}
root
(Number) 必传,设计图的宽度max
(Number) 非必传,最大响应宽度,超过该宽度则不响应跟字体大小变化watch
(Boolean) 非必传,是否开启监控屏幕变化,默认为truebody
上设置一个默认字体大小body {
font-size: 16rem;
}
FAQs
A JS plugin for responsive layout of web pages, used to dynamically respond to the rem units of Css on web pages
The npm package rem-responsive receives a total of 0 weekly downloads. As such, rem-responsive popularity was classified as not popular.
We found that rem-responsive demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.