博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
计算器代码示例代码_在移动设备上包装代码示例
阅读量:2510 次
发布时间:2019-05-11

本文共 1217 字,大约阅读时间需要 4 分钟。

计算器代码示例代码

One part of being a technical blogger that I've had to come to grips with is code samples and small mobile device screens.  I was amazed when I saw a double-digit percentage of visits to this blog were from mobile phones -- mental!  I started paying more attention to detail on said devices and I realized that code samples required loads of horizontal scrolling:  yuck.  By utilizing CSS white-space, we can make code wrap and avoid arm-numbing scrolling on small screens:

我必须要成为技术博客的一部分是代码示例和小型移动设备屏幕。 当我看到来自手机的访问量达到两位数时,我感到非常惊讶-精神! 我开始更加关注上述设备的细节,并且意识到代码示例需要水平滚动加载::。 通过使用CSS空格,我们可以进行代码换行并避免在小屏幕上进行麻木滚动:

pre {	white-space: pre-line;}

I like using PrismJS so that requires a different selector:

我喜欢使用PrismJS,因此需要其他选择器:

pre[class*='language-'], code[class*='language-'] {	white-space: pre-line;}

Thankfully white-space lets me help you all avoid horizontal scrolling on mobiles. Of course you'll need to choose which media query you want to apply that to, but I'll let you do that.  In some cases it may be difficult to read the line-broken code, but that's surely better than all that crazy scrolling.

值得庆幸的是,空白让我帮助您避免手机上的水平滚动。 当然,您需要选择要将其应用于哪个媒体查询,但我会让您做到这一点。 在某些情况下,读取断行代码可能很困难,但这肯定比所有疯狂的滚动更好。

翻译自:

计算器代码示例代码

转载地址:http://qzpwd.baihongyu.com/

你可能感兴趣的文章
Orcal Job创建实例
查看>>
Django
查看>>
批量Excel数据导入Oracle数据库(引用 自 wuhuacong(伍华聪)的专栏)
查看>>
处理移动障碍
查看>>
优化VR体验的7个建议
查看>>
2015年创业中遇到的技术问题:21-30
查看>>
《社交红利》读书总结--如何从微信微博QQ空间等社交网络带走海量用户、流量与收入...
查看>>
JDK工具(一)–Java编译器javac
查看>>
深入.NET框架与面向对象的回顾
查看>>
改变label中的某字体颜色
查看>>
七牛云存储之应用视频上传系统开心得
查看>>
struts2日期类型转换
查看>>
Spark2-数据探索
查看>>
Http和Socket连接区别
查看>>
Angular2,Springboot,Zuul,Shiro跨域CORS请求踩坑实录
查看>>
C语言中操作符的优先级大全
查看>>
pgpool-II - 介绍
查看>>
Alpha冲刺(10/10)——2019.5.2
查看>>
图书管理系统用例
查看>>
Microsoft patterns & practices 学习笔记(0)
查看>>