進化:從孤膽極客到高效團隊_極客狂:為什么這么多的網站無法使用打印樣式表?...

進化:從孤膽極客到高效團隊

進化:從孤膽極客到高效團隊

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.pswp.cn/news/280322.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/280322.shtml
英文地址,請注明出處:http://en.pswp.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…