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

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

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

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,一经查实,立即删除!

相关文章

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;也因此为整…

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’…

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;你已…

.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…

Spring Cloud Feign注意点

2019独角兽企业重金招聘Python工程师标准>>> 1、只要在启动类中加入EnableFeignClients注解&#xff0c;才会扫描FeignClient注解 2、Feign主要是通过接口调用&#xff0c;底层其实也是HttpClient/OkHttp 1&#xff09;提供一个Feign接口&#xff0c;加入对应的rest…

word 替换 增加引号_如何在Word 2013文档中替换部分(不是全部)智能引号

word 替换 增加引号Word includes a setting that allows you to automatically convert straight quotes to smart quotes, or specially curved quotes, as you type. However, there may be times you need straight quotes and you may have to convert some of the quotes…

i-i.me:网址导航真的是伪需求吗?

每一个程序员都有一个框架梦&#xff0c;每一个站长曾经都有一个网址导航梦。本人从07年开始接触互联网&#xff0c;成为一名中国草根站长&#xff0c;到现在终于熬成半个程序员。10年时间&#xff0c;没有赚到钱&#xff0c;也没有练就一身过硬的技术&#xff08;所以叫半个程…

.Net AOT--Win11搭建和编译 X64 汇编

楔子&#xff1a;windows11上编译x64汇编&#xff0c;很多人不太了解。甚至搞出DOSBox这种几亿年前的老古董&#xff0c;还有的专门搞些Linux下面的工具来搞到Windows上运行。其实这些大可不必&#xff0c;也没这么麻烦。微软技术出身&#xff0c;基本上工具链齐全。本篇来看下…

安装mongoDB遇见的一个路径问题

如果安装路径不存在&#xff0c;则不会解压EXE软件&#xff01; 安装monogoDB后&#xff0c;它不会自动添加执行路径&#xff01; 意思就是安装路径是D盘下面的mongoDB文件夹&#xff0c;假如不存在这个文件夹&#xff0c;则不会安装成功 你需要添加路径&#xff1a; 你可以利用…

【Filecoin源码仓库全解析】第一章:搭建Filecoin测试节点

2019.2.14 情人节&#xff0c;Filecoin项目开放了核心源码仓库go-filecoin&#xff0c;并更新了 filecoin-project organization下的诸多核心成果&#xff0c;这意味着&#xff0c;Filecoin已然度过了最困难的难点攻关期&#xff0c;进入到了全民公测阶段。 本系列文章将协助大…

DNS 代理?Pipy:这我也可以

Pipy 是个可编程代理&#xff0c;曾经我们做过 TCP/HTTP 代理、MQTT 代理、Dubbo 代理、Redis 代理、Thrift 代理。前几天有人问 DNS[1] 的代理能不能做&#xff1f;当然可以&#xff0c;而且 DNS 代理已经应用在 跨集群流量调度 中&#xff0c;文末经对此进行简单地介绍。阅读…

如何在Windows中快速轻松地将文件发送到SkyDrive

We have already shown you how you can share external folders with your SkyDrive, but what if you actually want to copy a file or folder into your SkyDrive folder? Of course copying and pasting is nowhere near geeky enough, so here’s how to add a SkyDrive…