进化:从孤胆极客到高效团队_极客狂:为什么这么多的网站无法使用打印样式表?...

进化:从孤胆极客到高效团队

进化:从孤胆极客到高效团队

image

It never ceases to amaze me that people have to look for a link or a button that says “Print” on a web page, especially considering there’s a miracle technology that makes that step unnecessary. Sadly almost nobody uses it, even though it’s… 10 years old.

人们不得不在网页上寻找显示“打印”的链接或按钮,这让我感到无比惊奇,尤其是考虑到有一种奇迹般的技术使这一步骤变得不必要。 可悲的是,几乎没有人使用它,即使它已经有10年了。

Not only is it silly to require an extra step for printing, but using print stylesheets would save some ink for anybody that doesn’t use the printable link. And of course, there’s loads of people that use print-to-PDF to save articles for later without wasting paper.

要求额外的打印步骤不仅很愚蠢,而且使用打印样式表可以为不使用可打印链接的任何人节省一些墨水。 当然,还有很多人使用“ PDF转换为PDF”来保存文章,以供日后使用而不会浪费纸张。

什么是打印样式表? (What Are Print Stylesheets?)

Most web sites implement their print function by taking you over to another page, which is formatted differently for printers – but this really isn’t necessary. Every browser implements a simple CSS technology known as Print Stylesheets, which is nothing more than a file that specifies elements to hide when your browser prints the page.

大多数网站通过将您带到另一个页面来实现其打印功能,该页面的格式与打印机的格式不同-但这确实不是必需的。 每个浏览器都实现一种称为打印样式表的简单CSS技术,该技术仅是一个文件,该文件指定了浏览器打印页面时要隐藏的元素。

For those that are unfamiliar, CSS means Cascading Style Sheets, and it’s how your browser knows how to format the HTML source code for a web page into what you actually see on the screen. Everything from fonts, colors, borders, and even background images can be specified in the style sheet.

对于那些不熟悉的人,CSS表示级联样式表,这是您的浏览器知道如何将网页HTML源代码格式化为您在屏幕上实际看到的格式。 可以在样式表中指定字体,颜色,边框甚至背景图片等所有内容。

Adding a print stylesheet is as simple as plugging this one single line into your page HTML—the media=print part of the code tells the browser to only use this style sheet when printing.

添加打印样式表就像将这一行插入页面HTML一样简单-代码的media = print部分告诉浏览器仅在打印时使用此样式表。

<link rel=”stylesheet” href=”print.css” type=”text/css” media=”print” >

<link rel =“ stylesheet” href =“ print.css” type =“ text / css” media =“ print”>

This file generally looks something like this:

该文件通常如下所示:

#sidebar, #footer, #navigation, #sharinglinks, #topad, #comments { display:none }

#sidebar,#footer,#navigation,#sharinglinks,#topad,#comments {display:none}

Yes, it’s really as simple as that. So how does it work? Here’s an example of a normal web page on the left, with all of the navigation, logo, and ads clearly visible with the ID associated – and on the right, the same page with the print stylesheet applied, hiding all of those elements.

是的,真的就是这么简单。 那么它是怎样工作的? 这是一个普通网页的示例,左侧显示所有导航,徽标和广告,并与ID关联-在右侧显示应用了打印样式表的同一页面,隐藏了所有这些元素。

image

Obviously you’d prefer to print one of these over the other, right?

显然,您更希望将其中之一打印出来,对吗?

打印样式表失败的示例 (Examples of Print Stylesheet Failure)

Unfortunately, there are just loads of huge web sites that haven’t bothered to implement this at all. Take a look at what happens when you try to print from the New York Times:

不幸的是,只有大量的大型网站根本没有去实现它。 看看当您尝试从《纽约时报》打印时会发生什么:

image

Some sites, like the Gawker network of sites, are even worse. Not only do they not have a printable view, when you do try and print, it resembles ink soup. As far as we can tell, there’s no way to print from a Gawker site without using a separate service like Readability, or manually highlighting the content on the page, which is nearly impossible on their new design.

某些网站,例如Gawker网站网络,甚至更糟。 它们不仅没有打印视图,而且在尝试打印时类似于墨水汤。 据我们所知,如果不使用诸如Readability的单独服务或手动突出显示页面上的内容,就无法从Gawker网站进行打印,这在他们的新设计中几乎是不可能的。

image

It’s sad, really. Loads of the largest sites just completely fail to bother implementing this feature.

真的很伤心。 最大的站点的负载完全无法解决此功能。

幸运的是,某些网站确实使用了它们 (Thankfully, Some Sites Do Use Them)

Here’s an example of a properly formatted printable view – without having to bother finding some print link. The BBC News site neatly formats the articles for print, complete with a custom header. They do include comments in the print view, but it’s still a job well done.

这是格式正确的可打印视图的示例-无需费心查找某些打印链接。 BBC新闻网站整齐地格式化了要打印的文章,并带有自定义标题。 它们的确在打印视图中包括了注释,但是仍然做得很好。

image

There’s quite a few other sites that do the same, like ArsTechnica and… our site, but it would be silly to show screenshots of all of them. In our research, the sites that properly implemented them are few and far between.

还有很多其他网站也可以做到这一点,例如ArsTechnica和…我们的网站,但是显示所有这些网站的屏幕截图很愚蠢。 在我们的研究中,正确实施它们的站点很少而且相差甚远。



So to wrap up… please take the 5 minutes required to implement a print stylesheet for your site!

因此,总结一下……请花5分钟为您的网站实施打印样式表!

翻译自: https://www.howtogeek.com/60744/geek-rants-why-do-so-many-web-sites-fail-to-use-print-stylesheets/

进化:从孤胆极客到高效团队

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/280322.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Iterator 和 for...of 循环

Iterator 和 for...of 循环 Iterator&#xff08;遍历器&#xff09;意义 为Array、Object、Map、Set四种数据集合&#xff0c;提供统一的接口机制来处理所有不同的数据结构 。 任何数据结构&#xff0c;只要部署 Iterator 接口&#xff0c;就可以完成遍历操作&#xff08;即依…

python简单开发接口

1、首先需要安装flask这个模块&#xff1a;pip install flask。flask是个轻量级的接口开发框架2、开发接口有什么作用  1、mock接口&#xff0c;模拟一些接口&#xff0c;在别的接口没有开发好的时候&#xff0c;需要用mock去模拟一些接口。  2、知道接口是怎么开发的&…

九哥聊Kestrel网络编程第二章:开发一个Fiddler

推荐序之前在.NET 性能优化群内交流时&#xff0c;我们发现很多朋友对于高性能网络框架有需求&#xff0c;需要创建自己的消息服务器、游戏服务器或者物联网网关。但是大多数小伙伴只知道 DotNetty&#xff0c;虽然 DotNetty 是一个非常优秀的网络框架&#xff0c;广泛应用于各…

apple tv 开发_如何跨多台Apple TV同步Apple TV的主屏幕

apple tv 开发If you have more than one Apple TV in your household, you probably know how annoying it is when you have to install Apple TV apps multiple times on each device. However, with the release of tvOS 11, that’s no longer the case. 如果您的家庭中有…

这些故事说的都是你——译者带你读《硅谷革命》

作者 | 薛命灯 作为《硅谷革命》的译者之一&#xff0c;同时也是一个拥有十余年软件开发和架构经验的工程师&#xff0c;当时我在决定是否接受重译这本书的时候&#xff0c;几乎是不假思索地答应了郭蕾&#xff08;本书重启版发起人之一&#xff09;的提议&#xff0c;只因他的…

runc容器逃逸漏洞最强后续:应对之策汇总与热点疑问解答

美国时间2019年2月11日晚&#xff0c;runc通过oss-security邮件列表披露了runc容器逃逸漏洞CVE-2019-5736的详情。runc是Docker、CRI-O、Containerd、Kubernetes等底层的容器运行时&#xff0c;此次安全漏洞无可避免地会影响大多数Docker与Kubernetes用户&#xff0c;也因此为整…

OOD之问题空间到解空间—附FP的建模

通常会被问到&#xff0c;什么事OOD&#xff0c;然后大部分人期待的答案比较死板&#xff0c;继承、封装、多态&#xff01;懂这个的人多的去了&#xff0c;有什么好问&#xff1f;回答出来的人是否拿着Java又去做一些面向过程的勾当&#xff1f; 计算机革命起源于机器&#xf…

com surrogate_什么是“ COM Surrogate”(dllhost.exe),为什么它在我的PC上运行?

com surrogateIf you poke around in your Task Manager, there’s a good chance you’ll see one or more “COM Surrogate” processes running on a Windows PC. These processes have the file name “dllhost.exe”, and are part of the Windows operating system. You’…

云计算时代,互联网金融背后的想象空间

本文讲的是云计算时代&#xff0c;互联网金融背后的想象空间&#xff0c;【IT168评论】阿里巴巴在纽交所的开市钟史无前例的由八位合作伙伴敲响&#xff0c;可见阿里对互联网时代构筑起生态系统的坚持。这其中&#xff0c;由余额宝所敲开的互联网金融热潮的热度持续不减&#x…

JavaScript数据结构与算法——集合

1.集合数据结构 集合是一组无序且唯一&#xff08;不能重复&#xff09;的项组成的。这个数据结构使用了和有限集合相同的数学概念。 2.创建集合 function Set() {// 这里使用对象而不是数组来表示集合 // js对象中不允许一个键值指向两个不同属性&#xff0c;也保证了集合中的…

php用两个栈来实现队列

php用两个栈来实现队列 一、总结 我主要的问题是不知道的是题目描述&#xff0c;题目和贵的代码之间的关系&#xff0c;以及返回值 思路&#xff1a;A栈做入队操作&#xff0c;B栈做出队操作&#xff0c;入队的时候元素直接入A&#xff0c;出队的时候判断B栈是否为空&#xff0…

facebook 邀请好友_如何查看紧急情况下您的Facebook朋友是否安全

facebook 邀请好友Facebook’s Safety Check feature lets you check in during an emergency to confirm you’re safe. If you have friends or family in an area that you haven’t heard from, though, you may want to ask them directly. Here’s how to ask someone to…

【您有一封来自阿里云的邀请函】阿里云成都客户服务中心20+职位虚席以待,来吧,成就最好的自己!...

如果你不想辜负这个科技的时代&#xff0c;相信它会因你而不同。如果你不想仅做年度大戏的观众&#xff0c;相信自己会成为主角。如果你不想淹没在枯燥与苟且中&#xff0c;相信工作有诗和远方。那么&#xff0c;不要犹豫&#xff0c;加入我们&#xff01;在这&#xff0c;你已…

A - A Secret -扩展KMP

题目大意&#xff1a;给你两个字符串A,B&#xff0c;现在要你求B串的后缀在A串中出现的次数和后缀长度的乘积和为多少。题解&#xff1a;扩展KMP模板题&#xff0c;将A和B串都逆序以后就变成了求前缀的问题了&#xff0c;扩展KMP求处从i位置开始的最长公共前缀存于数组。最后通…

.NET 代码优化 聊聊逻辑圈复杂度

本文属于 dotnet 代码优化系列博客。相信大家都对圈复杂度这个概念很是熟悉&#xff0c;本文来和大家聊聊逻辑的圈复杂度。代码优化里面&#xff0c;一个关注的重点在于代码的逻辑复杂度。一段代码的逻辑复杂度越高&#xff0c;那么维护起来的难度也就越大。衡量代码的逻辑复杂…

GO语言基础条件、跳转、Array和Slice

1. 判断语句if 1. 条件表达式没有括号&#xff08;这点其他语言转过来的需要注意&#xff09; 2. 支持一个初始化表达式&#xff08;可以是并行方式&#xff0c;即&#xff1a;a, b, c : 1, 2, 3) 3. 左大括号必须和条件语句或 else 在同一行 4. 支持单行模式 5. 初始化语句中的…

干式真空泵原理_如何安装干式墙锚在墙壁上悬挂重物

干式真空泵原理If you ever plan to mount something to the wall that’s even remotely heavy, you’ll need to use drywall anchors if a stud isn’t available. Here are the different types of drywall anchors, and how to use each one. 如果您打算将甚至更重的东西安…

sharding-jdbc学习

sharding-jdbc的全局id生成策略是通过雪花算法来实现的。 sharding-jdbc也是一个数据的中间件&#xff0c;可实现读写分离和分库分表&#xff0c;比mycat要简单些。 nginx与ribbon实现负载均衡的区别&#xff1a;nginx是实现服务器端的负载均衡&#xff0c;ribbon是实现客户端即…

像go 一样 打造.NET 单文件应用程序的编译器项目bflat 发布 7.0版本

现代.NET和C#在低级/系统程序以及与C/C/Rust等互操作方面的能力完全令各位刮目相看了&#xff0c;有人用C#开发的64位操作系统: GitHub - nifanfa/MOOS: C# x64 operating system pro...&#xff0c;截图要介绍的是一个结合Roslyn和NativeAOT的实验性编译器bflat &#xff1a;h…

添加dubbo.xsd的方法

整合dubbo-spring的时候&#xff0c;配置文件会报错 因为 阿里关闭在线的域名了.需要本地下载xsd文件 所以&#xff0c;需要下载本地引入。 解决方式&#xff1a; 在dubbo的开源项目上找到xsd文件&#xff1a; https://github.com/alibaba/dubbo Idea使用本地xsd Setting…