font-size

关于Web纯移动端适配各种手机型号的心得

感情迁移 提交于 2019-12-07 23:43:46
关于Web纯移动端适配各种手机型号的心得 em与rem的区别 Web纯移动端适配类型 第一种类型的适配 第二种类型的适配 第一次写博客,不喜勿喷,请见谅!!! em与rem的区别 在讲如何进行适配之前,我觉得很有必要先了解一下em和rem,作为一名前端开发者,不能只停留在px上。 em和rem相对于px来说,它们更加具有灵活性,它们是相对长度单位,也就是说长度不是一成不变的,它们更适用于响应式布局。 em ①如果子元素字体大小是em,那么它是相对于父元素的font-size的。 ②如果元素的width、height、padding、margin、top、left、bottom、right使用的是em的话,那么它是相对于本元素的font-size。 rem rem是全部元素的长度都相对于根元素html的fon-size的。 Web纯移动端适配类型 第一种是手机屏幕必须显示完整个页面,无滚动条,height和width都是100%。 第二种是width是100%、height超过屏幕高度的页面,有滚动条。 关于 本文章里 的所有代码,都是基于Vue.js的。 第一种类型的适配 对于这种类型的适配,使用的单位是em。 需要根据设计稿的高度与屏幕的高度得出比例,然后乘以预先设好的font-size。话不多说,直接上代码… html的head头设置 //index.html //设置head

移动端 H5 --页面适配(二)

六眼飞鱼酱① 提交于 2019-12-07 23:32:59
一、基础概念 在了解如何做H5页面适配前,大家都应该把移动端涉及的一些概念搞明白,比如:dpr 是什么意思? 移动端H5解惑-概念术语(一) 二、为什么要做页面适配 2.1 PC端为什么要解决浏览器兼容 因为在PC端,由于浏览器种类太多啦,比如几个常用的:IE、火狐、Chrome、Safari等。同时,由于历史原因,不同浏览器在不同时期针对当时的WEB标准有一些不一样的处理(虽然大部分一样),比如:IE6、IE8、IE10+等对于一些JS事件处理、CSS样式渲染有所不同。 而恰恰又有一些人在使用着不同类型的浏览器,以及不同浏览器的不同版本。所以,为了能让你的网站让这些不同的人看到效果一致,你就不得不做兼容,除非这些人不是你的目标用户。 2.2 移动端为什么要做适配 在移动端虽然整体来说大部分浏览器内核都是webkit,而且大部分都支持CSS3的所有语法。但是,由于手机屏幕尺寸不一样,分辨率不一样,或者你需要考虑横竖屏的问题,这时候你也就不得不解决在不同手机上,不同情况下的展示效果了。 另外一点,UI一般输出的视觉稿只有一份,比如淘宝就会输出:750px 宽度的(高度是动态的一般不考虑)(详情),这时候开发人员就不得不针对这一份设计稿,让其在不同屏幕宽度下显示 一致。 一致是什么意思?就是下面提到的几个主要解决的问题。 三、页面适配主要解决的问题 元素自适应问题 文字rem问题

整理H5|web移动前端自适应适配布局解决方案

為{幸葍}努か 提交于 2019-12-07 23:31:49
方案: 固定一个某些宽度,使用一个模式,加上少许的媒体查询方案 使用flexbox解决方案 使用百分比加媒体查询 使用 rem 1. 简单问题简单解决 我觉得有些 web app并一定很复杂,比如拉勾网,你看看它的页面在iphone4,iphone6,ipad下的样子就知道了: 它的页面有一个特点,就是: 顶部与底部的bar不管分辨率怎么变,它的高度和位置都不变 中间每条招聘信息不管分辨率怎么变,招聘公司的图标等信息都位于条目的左边,薪资都位于右边 这种app是一种典型的弹性布局:关键元素高宽和位置都不变,只有容器元素在做伸缩变换。对于这类app,记住一个开发原则就好:文字流式,控件弹性,图片等比缩放。以图描述: 这个规则是一套基本的适配规则,对于这种简单app来说已经足够,同时它也是后面要说的rem布局的基础。另外对于拉勾这种app可能需要额外媒介查询对布局进行调整的就是小屏幕设备。举例来说,因为现在很多设计稿是根据iphone6的尺寸来的,而iphon6设备宽的逻辑的像素是375px,而iphone4的逻辑像素是320个像素,所以如果你根据设计稿做出来的东西,在iphone4里面可能显示不下,比如说拉钩网底部那个下载框,你对比看下就知道了,这是4: 这是6: · 6下面两边的间距比4多很多,说明拉勾对4肯定是做过适配的,从 代码 也可以证实这一点:

rem布局实现不同分辨率移动终端的自适应、整体缩放

时光总嘲笑我的痴心妄想 提交于 2019-12-07 23:28:47
前言 现在手机屏幕分辨率越来越多,但我们的需求比较唯一——最佳视觉。 当用户浏览网页时,根据屏幕的尺寸,来向用户展示更适合用户的布局、文字、图片、按钮等等,因此,rem应运而生。 rem(font size of the root element)是指相对于根元素的字体大小的单位。一旦根节点html 定义的 font-size 变化,那么整个网页中运用到 rem的也会随之变化。加之当前手机淘汰速度较快,当前主流的手机内嵌浏览器内核版本均可以支持rem布局。 开撸 一般移动端的UI设计稿会采用iphone6宽度像素的尺寸作为标准——750,具体理由自行百度下,这里不再过多赘述。竖向一般不用考虑,基本是流布局,非限定一屏高度的话无影响。 本文以750设计稿为例。 第一步:设置初始rem css file: html { font-size : calc( 100 vw/ 7.5 ) ; } 说明: 100vw是设备的宽度,除以7.5可以让1rem的大小在iPhone6下等于100px。 第二部 全局px替换为rem 替换设计稿中的px为rem,注意rem=px/100,即font-size: 12px,需要写成font-size: .12rem,其他宽度、高度、间距等同理。由于rem是相对于根节点元素大小的单位,遂当设备宽度改变时,采用rem布局的大小均会跟随相同比例变化

How to implement responsive font size in rem - bootstrap

▼魔方 西西 提交于 2019-12-07 12:55:02
问题 I am using bootstrap 3 in my project and I see that there are 2 declarations of font-size in bootstrap as below: Scaffolding.less html { font-size:10px;} body{ font-size : @font-base-size; } And the @font-base-size is defined as 14px in variables.less I have been reading stuff where one way of having responsive font size was to have base font size as px defined in body or html as then use font sizes in rem for different components in body such as p, h1 etc. But I am not sure, where do I

How to bind Font Size to variable Grid Size

試著忘記壹切 提交于 2019-12-07 10:58:19
问题 I have a grid with 2 columns and 2 rows. A single character (Unicode U+2699) was placed inside the bottom right grid field. It looks like this: I´d like the character to automatically adjust its font size to fit the grid field it has been placed in (in this case it should be bound to the height of the second grid row, but since in some cases it could be unclear if the height or the width of the grid is smaller, it would be also nice to know how to bind to the lowest of those 2 values). My

jquery点击弹出登陆窗口

。_饼干妹妹 提交于 2019-12-07 09:52:04
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>jquery点击弹出登陆窗口</title> <style> body, h1, h2, h3, h4, h5, h6, p, blockquote, pre, code, del, dfn, em, img, strong, dd, dl, dt, li, ol, ul, fieldset, form, label, button, input, table, caption, tbody, tfoot, thead, tr, th, td, menu { margin:0; padding:0; } article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display

Possible to detect Bold Text setting in Settings > Accessibility?

穿精又带淫゛_ 提交于 2019-12-07 04:38:28
问题 With iOS 7, it's possible to code your app to respect the user's setting for Dynamic Type - larger or smaller font sizes. You use the method preferredFontForTextStyle: and then listen to notifications in order to update the UI if the user changes the setting while your app is running. I am wondering if it's possible to do the same thing with the accessibility option "Bold Text" found in Settings > Accessibility. I realized that the Bold Text option actually requires you to restart the device,

Label size in directlabels geom_dl()

微笑、不失礼 提交于 2019-12-06 20:58:19
问题 I have really enjoyed the package directlabels for dynamic positioning the lables of a plot. Although still not perfect, it helps reasonably to prevent overlaps between labels of a scatter plots with many points for example - specially for the draft version of the charts, not the final one. However I can not find anyway to change the label size while using geom_dl() function. Is there anyway? I have tried to pass size and cex as a normal or aes() argument to the function. 回答1: Put cex inside

本人博客样式

风流意气都作罢 提交于 2019-12-06 16:37:35
#site_nav_under { display: none; } .c_ad_block, .ad_text_commentbox { display: none; margin: 0; padding: 0; } #ad_under_google { height: 0; overflow: hidden; } #ad_under_google a { display: none; } @charset "utf-8"; #EntryTag { margin-top: 20px; font-size: 9pt; color: gray; } .topicListFooter { text-align: right; margin-right: 10px; margin-top: 10px; } #divRefreshComments { text-align: right; margin-right: 10px; margin-bottom: 5px; font-size: 9pt; } * { margin: 0; padding: 0; } html { height: 100%; } body { background: url(https://i.loli.net/2017/08/15/59923c58cc40f.jpg) no-repeat fixed;