web 响应式

I recently received a question from a reader regarding development of a single-page HTML résumé, with an example at CSS Tricks cited as a particular inspiration. While Chris Coiyer’s work was excellent, the three years since the original article was published provided an opportunity to improve on the design. In particular:

最近,我收到了一个读者的有关单页HTML简历开发的问题, 并引用了CSS Tricks上的一个示例作为特别的启发。 尽管Chris Coiyer的工作非常出色,但是自原始文章发表以来的三年时间为改进设计提供了机会。 特别是:

  1. The markup for the résumé could be simplified and improved (Chris’s technique uses a lot of empty div tags).

    简历的标记可以简化和改进(克里斯的技术使用了很多空的div标签)。

  2. Responsive design techniques could be introduced into the CSS so that the page could be read well on both mobile and desktop browsers.

    可以将响应设计技术引入CSS,以便可以在移动和桌面浏览器上很好地阅读页面。

  3. Effects on the profile photo could be achieved with CSS transforms, rather than being baked into the image with PhotoShop.

    可以通过CSS转换来实现对个人资料照片的效果,而不是通过PhotoShop将其烘焙到图像中。

A complete version of the responsive web résumé is available on CodePen. The markup for the résumé is minified HTML5:

可在CodePen上获得响应式Web简历的完整版本 。 简历的标记是最小化HTML5 :

HTML (The HTML)

<div><h1><img src="james-moriarty.jpg" alt="Etching of James Moriarty">James Moriarty</h1>
<p>Cell:<a href="tel:1-555-666-7777">555-666-7777</a>
<p>Web:<a href="//moriarty.com">moriarty.com</a>Email: napoleon@crime.com
<p id="objective">I am a reserved but ambitious young professional, seeking a career thatfits my professional skills, personality, and murderous tendencies. My good birth, excellent
education and phenomenal mathematical faculty have allowed me to advance the prospects
of several criminal enterprises.<dl><dt>Education<dd><h2>Oxford University</h2><p><strong>Major:</strong> Applied Mathematics<br><strong>Minor:</strong> Romance Languages</dd>
</dl>
<dl><dt>Skills<dd><h2>Office Skills</h2><p>Office and records management, database administration, event organization, customer support, travel coordination<h2>Computer skills</h2><p>Microsoft productivity software (Word, Excel, etc), Adobe Creative Suite, Windows</dd>
</dl>
<dl><dt>Experience<dd><h2>Consulting Criminal<span>London 1892 – present</span></h2><ul><li>Development within the criminal underworld<li>Conducted negotiations with several rouge governments</ul><h2>The Coldstream Guards<span>Army Coach,
London 1889 – 1888</span></h2><ul><li>Recruiting, training and terrorizing young men.</ul><h2>Oxford University<span>Professor of Mathematics
1885 – 1888</span></h2><ul><li>Published papers in binomials, asteroid dynamics and game theory<li>Intimidated students</ul></dd></dl>
</div>

As you can see, markup is standard headings and lists. I’ve added a dynamic link for the telephone number, so that it may be called directly from the page, but there’s nothing else special about the code at this stage.

如您所见,标记是标准标题和列表 。 我为电话号码添加了一个动态链接 ,以便可以直接从页面中调用它,但是此阶段的代码没有其他特殊之处。

CSS (The CSS)

* { box-sizing: border-box; }
body { margin: 2.2rem; }
div { min-width: 380px; background: url('noise.jpg');font: 16px Helvetica, sans-serif;line-height: 24px;
}
h1 {margin: 0 0 16px 0;padding: 0 0 16px 0;font-size: 42px;font-weight: bold;letter-spacing: -2px;border-bottom: 1px solid #999;line-height: 50px; }
h2 { font-size: 20px;margin: 0 0 6px 0;position: relative;
}
h2 span {position: absolute;bottom: 0; right: 0;font-size: 16px;color: #999;font-weight: normal;
}
p { margin: 0 0 16px 0; }
a { color: #999; text-decoration: none;border-bottom: 1px dotted #999;
}
a:hover {border-bottom-style: solid;color: black; }
p#objective {color: #666;
}
h2 span, p#objective {font-family: Georgia, serif;font-style: italic;
}
dt {font-style: italic;font-weight: bold;font-size: 18px;text-align: right;padding: 0 26px 0 0;width: 150px;border-right: 1px solid #999;
}
dl { display: table-row; }
dl dt, dl dd {display: table-cell;padding-bottom: 20px;
}
dl dd {width: 500px;padding-left: 26px;
}

I’m using fairly standard CSS here, with box-sizing set up to make measuring containers easier. Similarly, fonts are measured in pixels for ease of use; ideally the typefaces would be measured in rem or – once browsers begin to support it – vw units. I’ve used Chris’ noise image as a background-image to provide more of a page feel, with the same fonts. The education, skills and experience sections are placed side-by-side through the use of display: table and related values. We’re using position: absolute on the <span> elements inside the headings with position: relative applied so that we can place the <span> content flush right on the same line. Note that you’d need to add vendor prefixes to support the rotation of the image in current browsers.

我在这里使用相当标准CSS,并设置了box-sizing以方便测量容器。 同样, 字体以像素为单位,以方便使用。 理想情况下,字体的字体应以rem或(一旦浏览器开始支持) vw单位进行度量 。 我将克里斯的杂色图像用作background-image ,以相同的字体提供了更多的页面感觉。 通过使用display: table和相关值,教育,技能和经验部分并排放置。 我们使用position: absolute<span>与标题中的元素position: relative应用,使我们可以将<span>在同一行内容右对齐。 请注意,您需要添加供应商前缀来支持当前浏览器中图像的旋转 。

In the words of Ethan Marcotte, this CSS is effectively the default responsive style sheet for those browsers that don’t yet support media queries. The only responsive portion is the style declaration that we place on the image: rather than measuring its width and height in pixels, we measure the picture’s width as a percentage relative to the document it is a part of:

用Ethan Marcotte的话来说,对于那些尚不支持媒体查询的浏览器,此CSS实际上是默认的响应样式表。 唯一的响应部分是我们放置在图像上的样式声明:我们不是以像素为单位来衡量其宽度和高度,而是以相对于其所包含的文档的百分比衡量图片的宽度

制作响应式图像 (Making A Responsive Image)

img {float: right;padding: 10px;background: #fff;margin: 0 30px;transform: rotate(-4deg);box-shadow: 0 0 4px rgba(0,0,0,0.3);width: 30%; max-width: 220px;
}

We assign a max-width to the image so that it doesn’t grow too large in comparison to the document at large window sizes. Browsers that don’t support this property will display the image at its native size. Browser that do support max-width should also respond to media queries: for those, we will add breakpoints where the design starts to look bad as the browser narrows, not in response to specific measurements for any particular device:

我们为图像分配max-width ,以便与大窗口尺寸的文档相比,它不会变得太大。 不支持此属性的浏览器将以原始大小显示图像。 浏览器支持max-width也应媒体询问作出答复:针对这一情况,我们将添加断点在设计开始看起来很糟糕的浏览器变窄 ,不响应任何特定的设备特定的测量:

添加@media查询 (Adding the @media Queries)

@media screen and (max-width: 1100px) {h2 span {position: static;display: block;}
}
@media screen and (max-width: 550px) {img {transform: rotate(0deg);}
}
@media screen and (max-width: 400px) {dl dt {border-right: none;border-bottom: 1px solid #999;}dl, dl dd, dl dt {display: block;padding-left: 0;margin-left: 0;padding-bottom: 0;text-align: left;width: 100%;}dl dd {margin-top: 6px;}h2 {font-style: normal;font-weight: 400;font-size: 18px;}dt { font-size: 20px; }img { margin: 0; }
}

These media queries are essentially a series of if statements in CSS: if the browser window is 1100 pixels wide or less, we break the span elements from being flush right to place them underneath the headings; at 550px, this rule is joined by rotating the image upright, and at 400 pixels and below, we display most of the resume with block so that the information falls vertically, rather than being arranged horizontally.

这些媒体查询本质上是CSS中的一系列if语句:如果浏览器窗口的宽度为1100像素或更小,我们将span元素从齐平的位置移到标题的下面; 在550像素处,此规则通过垂直旋转图像而结合在一起;在400像素及以下像素处,我们使用block显示大多数简历,以使信息垂直放置而不是水平放置。

Don’t forget to add the "I know what I’m doing" meta tag for responsive design into the <head> of your document, so that your page is scaled correctly on mobile devices:

不要忘记将响应式设计的“我知道我在做什么” meta标记添加到文档的<head>中,以便在移动设备上正确缩放页面:

<meta name="viewport" content="width=device-width, initial-scale=1.0">

结论 (Conclusion)

This completes the presentation of our page, but it is still missing microformat information, which will greatly benefit its position in search engines… and since the very point of a résumé is for it to be found, that is an aspect I address in the next article.

这样就完成了我们页面的介绍,但是仍然缺少微格式信息,这将极大地有利于其在搜索引擎中的地位……而且,因为要找到简历的重点,所以我接下来要解决的一个方面文章。

翻译自: https://thenewcode.com/553/Build-A-Responsive-Web-Resume

web 响应式

web 响应式_建立响应式Web简历相关推荐

  1. java web认证考试_用Java实现Web服务器HTTP协议

    一.HTTP协议的作用原理 HTTP协议的作用原理包括四个步骤: 1.连接:Web浏览器与Web服务器建立连接.2.请求:Web浏览器通过socket向Web服务器提交请求.3.应答:Web浏览器提交 ...

  2. 渐进式web应用程序_如何在渐进式Web应用程序中添加到主屏幕

    渐进式web应用程序 添加到主屏幕 (Add To Homescreen) Here the web app install banner is focused on web app, with th ...

  3. java web应用程序_如何构建Java Web 应用程序 - Spring Boot?

    Spring Framework 是可以帮助 Java 开发人员创建企业级应用程序的开源解决方案.构建在该平台基础之上的较热门项目之一是 Spring Boot,它提供一种简化的方法来创建独立的 Ja ...

  4. 产生式是蕴含式_独栋别墅~下沉式庭院设计

    遇见美. 发现美 创造美. 成就美 有趣.有情 奢享生活.创艺空间设计 项目概述:这是一套婚房,从设计到装修完毕,历经三年.这是一生幸福开启的地方.一层为会客厅.室内花园.餐厅.茶室.老人房.原始房屋 ...

  5. python的各种推导式_各种推导式(comprehensions)

    推导式(又称解析式)是Python的一种独有特性,如果我被迫离开了它,我会非常想念.推导式是可以从一个数据序列构建另一个新的数据序列的结构体. 共有三种推导,在Python2和3中都有支持: 列表(l ...

  6. java 非侵入式_非侵入式设计 和侵入式设计 意思?

    非侵入式系介绍DI用语,我得理解是两个组件(类,接口)之间,比较独立,不深入到另一个类内部,哪位大虾能点拨一二? 关于"侵入式"和"非侵入式"设计 有读者讲&q ...

  7. Python笔记_13_推导式_集合推导式_字典推导式_生成器

    文章目录 推导式 基本语法 带有条件判断的推导式 多循环推导式 带有判断条件的多循环推导式 测试题 集合推导式 字典推导式 enumerate zip 生成器 generator 生成器表达式 生成器 ...

  8. java web 进度条_教你制做Web实时进度条

    网上已经有很多Web进度条的例子,但是很多都是估算时间,不能正真反应任务的真实进度.我自己结合多线程和ShowModalDialog制做了一个实时进度条,原理很简单:使用线程开始长时间的任务,定义一个 ...

  9. canvas画布响应式_检查响应式导航:离开画布模式

    canvas画布响应式 在本教程中,我们将遍历四种模式的变体,其中导航和页面内容放在画布之外,以节省空间,直到请求. 是时候停止复制和粘贴了,让我们开始理解! 回顾一下,本系列文章的第一个重点是导航保 ...

最新文章

  1. 到喜啦携手神策数据,大数据加速产品服务的创新整合发展
  2. 直播进行中|谁在玩转数字中国?腾讯里约带你启动数字化转型之旅
  3. 布局中常见的居中问题
  4. 前端学习(310):清除浮动的方法
  5. 计算机启用网络查找,怎么搜索局域网中的电脑
  6. java.sql.SQLException: Access denied for user ‘‘@‘localhost‘ (using password: NO)报错问题解决
  7. Lua 中的 function、closure、upvalue
  8. Mysql递归查询优化记录
  9. C语言作业怎么答辩,c语言贪吃蛇如何答辩
  10. 台式计算机模拟软件,仿真软件 计算机仿真模拟常用软件有那些?
  11. 我珍藏很久的网盘资源搜索网站和下载神器
  12. TQ2440开发板移植UBOOT-2010.06总结(3)
  13. Linux 磁盘管理的命令
  14. 软件设计师2022记录
  15. 毛远丽教授谈机器学习技术在检验医学中的新应用|专家论坛
  16. java 32位兼容_Java 32位与64位兼容性
  17. PHP抓取页面的几种方式
  18. [问题]mpu9250+bmp280数据读取
  19. 飞龙射击(Unity2D入门小游戏)
  20. 11【门面设计模式】

热门文章

  1. 超写实虚拟人制作模拟真人般交流互动
  2. 数据流分析基础和局域网基础
  3. 2021我上岸了!分享我的招银网络科技 一二三面面经,希望对大家有帮助!
  4. mysql sql rowcount_ORACLE中的SQL%ROWCOUNT与MySQL中的ROW_COUNT()的一点异同-阿里云开发者社区...
  5. 网络游戏demo开发实例:多人在线RPG游戏(MMO RPG)demo的开发记录(第3篇)
  6. 考研不歧视双非的院校计算机专业,考研23所良心大学:不歧视“双非”,且保护一志愿。赶紧看过来!...
  7. 外汇天眼:国庆特辑⑤·中国外汇交易商的交易模式
  8. Wireshrk 3.0.0网络抓包工具安装及使用(图文教程)
  9. #初学C语言,写个九九乘法口诀,请笑纳
  10. 【软件】大企业ERP选型的方法