em

HTML

和自甴很熟 提交于 2019-12-28 02:54:32
一、HTML基础 1.1 HTML HTML : Hyper Text MarkUp Language (超文本标记语言) HTML案例 <!DOCTYPE html> < html lang = " en " > < head > < meta charset = " UTF-8 " > < title > 静夜思 </ title > </ head > < body > < h1 > 静夜思 </ h1 > < em > 朝代:唐代 </ em >       作者: < strong > 李白 </ strong > < br /> < hr /> < p > 床前明月光, < br /> 疑是地上霜, < br /> 举头望明月, < br /> 低头思故乡。 < br /> </ p > </ body > </ html > 常见的前端开发工具 记事本 Notepad++ Sublime VScode(前端专业) WebStorm(前端专业) IDEA HBuilder (专业) 1.2、HTML的基本结构 HTML的基本结构 所有的HTML 标签 都以 <> 开始 </> 结尾 正常网页的所有内容都需要放在 < body> 标签中; <!DOCTYPE html> < html lang = " en " > < head > <!--自闭合标签--> < meta

rem与em

耗尽温柔 提交于 2019-12-27 17:29:58
链接:http://caibaojian.com/rem-vs-em.html 你可能已经很熟练使用这两个灵活的单位,但你可能不完全了解何时使用 rem ,何时使用 em。 本教程将帮你弄清楚! Em 和 rem都是灵活、 可扩展的单位,由浏览器转换为像素值,具体取决于您的设计中的字体大小设置。 如果你使用值 1em 或 1rem,它可以被浏览器翻译成 从16px到 160px 或其他任意值。 CSS 边距设置为 1em 浏览器翻译成16px CSS padding设为 16px 浏览器翻译成160px 另一方面,浏览器使用 px 值,所以 1px 将始终显示为完全 1px。 滑动滑块试试这个 CodePen 例子,你可以看到rem 和 em 单位的值可以转化为不同的像素值,而 px 单位保持固定大小: 最大的问题是 使用 em 和 rem 单位可以让我们的设计更加灵活,能够控制元素整体放大缩小,而不是固定大小。 我们可以使用这种灵活性,使我们在开发期间,能更加快速灵活的调整,允许浏览器用户调整浏览器大小来达到最佳体验。 Em 和 rem 单位提供的这种灵活性和工作方式都很相似,所以最大的问题是,我们何时应使用 em 值,何时应使用 rem 值呢? 主要区别 Em 和 rem 单位之间的区别是浏览器根据谁来转化成px值 理解这种差异是决定何时使用哪个单元的关键。 我们要通过复习

神奇的Shadow DOM

ぐ巨炮叔叔 提交于 2019-12-26 13:51:39
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 你有好奇过这个问题吗,为什么只用video标签包裹着source标签,就可以完成一系列视频功能:播放/暂停按钮、进度条、视频时间显示、音量控制等等?既然 DOM 源码这么干净,你有想过实现这些组件的代码是从哪儿来的吗? 1. 简介 Shadow DOM它允许在文档(document)渲染时插入一棵DOM元素子树,但是这棵子树不在主DOM树中。 因此开发者可利用Shadow DOM 封装自己的 HTML 标签、CSS 样式和 JavaScript 代码。 看一个简单的video: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Shadow DOM</title> </head> <body> <video controls autoplay name="media" width="500"> <source id="mp4" src="http://7ryl2t.com2.z0.glb.qiniucdn.com/572ffc37a2e5a.mp4" type="video/mp4"> </video> </body> </html> 页面完成了

How to work out EM based media query

北慕城南 提交于 2019-12-25 12:58:06
问题 I'm trying to work out how to use EM media queries in my latest project. However after some testing I've found that the media queries are ever so slightly off and I can't work out why. It might have something to do with it using the parents font size instead of the body. My body is set to 14px and my workings out look like: $break-small: 22.8571em; //320px $break-smallish: 40em; //560px $break-med: 54.8571em; //768px $break-medish: 68.5714em; //960px $break-desk: 73.1428em; //1024px body font

Responsive CSS: em's wont resize lower than <0.5em

牧云@^-^@ 提交于 2019-12-25 01:33:02
问题 I am coding my first responsive layout using CSS @media queries. I've added the <meta name="viewport" content="width=device-width"> to my html so I have a strict series of device-width based font-size layouts. And, I'm using em 's to (hopefully) give the most consistant browser resizing with html, body {width/height:100%; font-size: 1em} . In my smallest case, I want to put the <h2> tag at a relatively small em in the range of < 0.5em. However, once I go below that amount it no longer resizes

Core Text glyph placement and em values

ⅰ亾dé卋堺 提交于 2019-12-24 19:11:36
问题 I am trying to draw some musical notes using the Bravura font from http://blog.steinberg.net/2013/05/introducing-bravura-music-font/ using core text functions. A metadata json file accompanying this font has an "attach" coordinate in em unit fractions for where stems should be attached to certain musical notes. This attachment point is relative to a bounding box around the note glyph again with the dimensions in fractions of em unit. My crude ASCII picture shows the attach point of the stem

Why does the <button> tag treat em differently from how a <div> does?

倖福魔咒の 提交于 2019-12-24 12:34:18
问题 I've noticed that <button> tags seem to be scaling em units from something other than the font-size. <div> tags aren't exhibiting this same behaviour. This happens across the latest versions of chrome, firefox & ie. They are both styled like this: button, div { width: 3rem; height: 3em; } See this fiddle for an example. If I size a div and a button both with a width of 3rem and height of 3em, I would expect them to be square, unless there is a font-size style affecting one of them, or an

How to guarantee an element will have a particular height

浪尽此生 提交于 2019-12-24 08:34:44
问题 Say that I have this element on my page: <div style="height: 1em;"> </div> I want to use JavaScript to measure the height of the div to figure out how many px are equivalent to 1em for that element. So if I did: document.querySelector('div').getBoundingClientRect() Then I might get 16 . But what if users can inject arbitrary styles onto this webpage? What if they do something like: div { border: 1px solid black; } Then I would get 18 , because of the unexpected border applied to all div

Chrome renders em based font sizes differently on devices

泪湿孤枕 提交于 2019-12-24 01:55:32
问题 I'm having an issue comparing font sizes between pages on my layout. I have the font set on the body with font-size: 100%; and on my paragraph tags with font-size: 1em; . I have a two column page set with CSS columns and a single column layout. The font is rendering larger on the single column page. It's also rendering differently with font-size: .75em; in the footer and on a main section of my site. I've determined that it's Chrome only and appearing to cause the issue on the Nexus 7. The

Chrome renders em based font sizes differently on devices

左心房为你撑大大i 提交于 2019-12-24 01:55:10
问题 I'm having an issue comparing font sizes between pages on my layout. I have the font set on the body with font-size: 100%; and on my paragraph tags with font-size: 1em; . I have a two column page set with CSS columns and a single column layout. The font is rendering larger on the single column page. It's also rendering differently with font-size: .75em; in the footer and on a main section of my site. I've determined that it's Chrome only and appearing to cause the issue on the Nexus 7. The