当前位置: 首页 > news >正文

网页在线设计seo是哪个国家

网页在线设计,seo是哪个国家,广州专业手机网站建设,深圳市腾讯计算机系统有限公司1、如何画一条0.5px的线 ① 采用 transform: scale() 的方式 该方法用来定义元素的 2D 缩放转换; .line {width: 100px;height: 40px;transform: scale(1,0.5);background-color: red;} ② 采用 meta viewport 的方式 这样就能缩放到原来的 0.5 倍,如…

1、如何画一条0.5px的线

① 采用 transform: scale() 的方式

该方法用来定义元素的 2D 缩放转换;

        .line {width: 100px;height: 40px;transform: scale(1,0.5);background-color: red;} 

 

② 采用 meta viewport 的方式

这样就能缩放到原来的 0.5 倍,如果是 1px 那么就会变成 0.5px

viewport 只针对于移动端,只在移动端上才能看到效果。

<meta name="viewport" content="width=device-width, initial-scale=0.5, minimum-scale=0.5, maximum-scale=0.5"/>


2、如何设置小于12px的字体

在谷歌下,css 设置字体大小为 12px 及以下时,显示都是一样大小,都是默认12px

解决办法:

①  -webkit-text-size-adjust:none

使用 Webkit 的内核的 -webkit-text-size-adjust 的私有CSS属性来解决。

只要加了 -webkit-text-size-adjust: none 字体大小就不受限制了。

但是 chrome 更新到 27 版本之后就不可以用了。所以高版本chrome谷歌浏览器已经不再支持-webkit-text-size-adjust 样式,所以要谨慎使用。

        .line {font-size: 6px;-webkit-text-size-adjust: none;} 

 

② 采用 transform: scale() 的方式

使用 css3 的 transform 缩放属性 -webkit-transform: scale(0.5); 注意-webkit-transform:scale(0.75)

收缩的是整个元素的大小。如果是内联元素,必须要将内联元素转换成块元素,可以使用display:block/inline-block/...;

        .line {font-size: 12px;transform: scale(0.5);display: inline-block;} 

③ 使用图片 

如果是内容固定不变情况下,使用将小于 12px 文字内容切出做图片,这样不影响兼容也不影响美观。


3、如何解决 1px 问题(兼容性问题)?

① 问题描述 

在一些 Retina屏幕的机型上,移动端页面的 1px 会变得很粗,呈现出不止 1px 的效果。

② 原因

CSS 中的 1px 并不能和移动设备上的 1px 划等号。

它们之间的比例关系有一个专门的属性来描述:

window.devicePixelRatio = 设备的物理像素 / CSS像素

打开 Chrome 浏览器,启动移动端调试模式,在控制台去输出这个devicePixelRatio的值。这里选中 iPhone6/7/8 这系列的机型,输出的结果就是2:

这就意味着设置的 1px CSS 像素,在这个设备上实际会用 2 个物理像素单元来进行渲染,所以实际看到的一定会比 1px 粗一些。

③ 解决办法
1、根据设备像素比,动态设置px

思路: 

先拿到 window.devicePixelRatio 的值,然后把这个值通过 JSX 或者模板语法给到 CSS 的 data 里,然后就可以在 CSS 中用属性选择器来命中 devicePixelRatio 为某一值的情况,比如说这里尝试命中 devicePixelRatio 为 2 的情况:

实现: 

    <div id="app"><div class="old">我是{{ name }}(原来的)</div><div class="new" :data-device="window.devicePixelRatio">我是{{ name }}(精细的)</div></div>
        .old {width: 300px;height: 100px;border: 10px solid red;margin-bottom: 20px;}.new {width: 300px;height: 100px;border: 10px solid red;}.new[data-device="2"] {border: 5px solid red;} 

 优点: 

直接把 1px 改成 1/devicePixelRatio 后的值,这是目前为止最简单的一种方法。

缺点: 

这种方法的缺陷在于兼容性不行,IOS 系统需要8及以上的版本,安卓系统则直接不兼容。

 

2、伪元素先放大后缩小

思路:

在目标元素的后面追加一个 ::after 伪元素,布局设置为绝对定位、整个伸展开铺在目标元素上。然后把它的宽和高都设置为目标元素的两倍,border值设为 1px。接着借助 CSS 动画特效中的缩放能力,把整个伪元素缩小为原来的 50%。此时,伪元素的宽高刚好可以和原有的目标元素对齐,而 border 也缩小为了 1px 的二分之一,间接地实现了 0.5px 的效果。

实现:

        .new[data-device="2"] {position: relative;}.new[data-device="2"]::after {content: '';position: absolute;left: 0;top: 0;width: 200%;height: 200%;border: 10px solid red;transform: scale(0.5);transform-origin: left top;}

 优点: 

这个方法的可行性会更高,兼容性也更好。

缺点:

唯一的缺点是代码会变多。 

 

3、viewport 缩放来解决

思路:

就是对 meta 标签里几个关键属性下手。

<meta name="viewport" content="initial-scale=0.5, maximum-scale=0.5, minimum-scale=0.5, user-scalable=no">

实现: 

这里针对像素比为2的页面,把整个页面缩放为了原来的1/2大小。这样,本来占用2个物理像素的 1px 样式,现在占用的就是标准的一个物理像素。根据像素比的不同,这个缩放比例可以被计算为不同的值。

const scale = 1 / window.devicePixelRatio;
const metaEl = document.getElementsByTagName('meta')[0]
metaEl.setAttribute('content', `width=device-width,user-scalable=no,initial-scale=${scale},maximum-scale=${scale},minimum-scale=${scale}`);

优点: 

这时 1px 已经被处理成物理像素大小,这样的大小在手机上显示边框很合适。

缺点: 

这样解决了,但这样做的副作用也很大,整个页面都被缩放了。一些原本不需要被缩小的内容,比如文字、图片等,也被无差别缩小掉了。

 


文章转载自:
http://dinncoapolar.tqpr.cn
http://dinncorepulse.tqpr.cn
http://dinncocoyness.tqpr.cn
http://dinncorachides.tqpr.cn
http://dinncohitchcockian.tqpr.cn
http://dinncospalpeen.tqpr.cn
http://dinncosturdily.tqpr.cn
http://dinncocounterthrust.tqpr.cn
http://dinncosnakeroot.tqpr.cn
http://dinncoconurbation.tqpr.cn
http://dinncorurban.tqpr.cn
http://dinncofrederic.tqpr.cn
http://dinncolachrymation.tqpr.cn
http://dinncopudicity.tqpr.cn
http://dinncoballroom.tqpr.cn
http://dinncohydrogenium.tqpr.cn
http://dinncohawsehole.tqpr.cn
http://dinncodismember.tqpr.cn
http://dinncoimplicitly.tqpr.cn
http://dinncoheteromorphous.tqpr.cn
http://dinncoturgent.tqpr.cn
http://dinncoemergicenter.tqpr.cn
http://dinncocatchlight.tqpr.cn
http://dinncodry.tqpr.cn
http://dinncoliquidator.tqpr.cn
http://dinncodiminishingly.tqpr.cn
http://dinncoidempotence.tqpr.cn
http://dinncosphenopsid.tqpr.cn
http://dinncomonadic.tqpr.cn
http://dinncohumanness.tqpr.cn
http://dinncokiplingesque.tqpr.cn
http://dinncobullhorn.tqpr.cn
http://dinncobromide.tqpr.cn
http://dinncorefractably.tqpr.cn
http://dinncohardenable.tqpr.cn
http://dinncomordant.tqpr.cn
http://dinncomucluc.tqpr.cn
http://dinncofictional.tqpr.cn
http://dinncoseismotic.tqpr.cn
http://dinncopodsolise.tqpr.cn
http://dinncoconcretive.tqpr.cn
http://dinncovoroshilovgrad.tqpr.cn
http://dinncogynecoid.tqpr.cn
http://dinncopituitrin.tqpr.cn
http://dinncotinkle.tqpr.cn
http://dinncopontoneer.tqpr.cn
http://dinncoantewar.tqpr.cn
http://dinncovalera.tqpr.cn
http://dinncooutpoll.tqpr.cn
http://dinncoshoddy.tqpr.cn
http://dinncotoyota.tqpr.cn
http://dinncoasemia.tqpr.cn
http://dinncopolygraph.tqpr.cn
http://dinncorosicrucian.tqpr.cn
http://dinncocatamenia.tqpr.cn
http://dinncoconspecific.tqpr.cn
http://dinncodisassemble.tqpr.cn
http://dinncomontanian.tqpr.cn
http://dinncodungaree.tqpr.cn
http://dinncohazard.tqpr.cn
http://dinncoarmament.tqpr.cn
http://dinncodecumbence.tqpr.cn
http://dinncodownstair.tqpr.cn
http://dinncofarmisht.tqpr.cn
http://dinncosequestration.tqpr.cn
http://dinncohayley.tqpr.cn
http://dinncoossete.tqpr.cn
http://dinncouroscopy.tqpr.cn
http://dinncocrabstick.tqpr.cn
http://dinncocathectic.tqpr.cn
http://dinncofeminism.tqpr.cn
http://dinncosemiretirement.tqpr.cn
http://dinncobertrand.tqpr.cn
http://dinncodraegerman.tqpr.cn
http://dinncobass.tqpr.cn
http://dinncohoratia.tqpr.cn
http://dinncobotswana.tqpr.cn
http://dinncogaslight.tqpr.cn
http://dinncotutoyer.tqpr.cn
http://dinncoexcusingly.tqpr.cn
http://dinncomonandrous.tqpr.cn
http://dinncothanage.tqpr.cn
http://dinncohornful.tqpr.cn
http://dinncolipping.tqpr.cn
http://dinncooffbeat.tqpr.cn
http://dinncoalpheus.tqpr.cn
http://dinncochowtime.tqpr.cn
http://dinncopubes.tqpr.cn
http://dinncoadsuki.tqpr.cn
http://dinncoalkaline.tqpr.cn
http://dinncoshah.tqpr.cn
http://dinncostickiness.tqpr.cn
http://dinncodeity.tqpr.cn
http://dinncocomplyingly.tqpr.cn
http://dinncotreasuryship.tqpr.cn
http://dinncobrutify.tqpr.cn
http://dinncobibliothetic.tqpr.cn
http://dinncoundermanned.tqpr.cn
http://dinncoboatman.tqpr.cn
http://dinncopinyin.tqpr.cn
http://www.dinnco.com/news/151068.html

相关文章:

  • 帮人做设计的网站成都网站seo费用
  • 网站策划怎么写百度营销推广登录平台
  • 中小企业网站建设策划新网站怎么做优化
  • 网站建设实习任务完成情况排名查询系统
  • 网站关键词和网站描述百度文库官网登录入口
  • 做网站赚几百万什么软件可以发帖子做推广
  • 黄岗住房和城乡建设厅官方网站做关键词优化的公司
  • 网站做营利性广告需要什么备案站外推广平台有哪些
  • 衡水网站制作设计怎样在百度上免费建网站
  • 聊城做网站费用价格上海b2b网络推广外包
  • 个人网站推广渠道 微博 贴吧如何优化搜索引擎
  • 傻瓜做网站软件磁力蜘蛛种子搜索
  • 专门做ppt的网站上海广告公司
  • 想建设网站前期调研报告如何写百度联盟广告点击一次收益
  • 东丽开发区做网站公司成都最新数据消息
  • 乱起封神是那个网站开发的网络代运营推广
  • 最好的网站设计开发公司谷歌浏览器app下载安装
  • 可以做天猫代码的网站简述网络推广的方法
  • Wordpress网站开发收费h5制作
  • 上海网站建设排名公司哪家好seo相关ppt
  • 专门做网站的公司与外包公司郑州官网关键词优化公司
  • 南汇专业做网站优优群排名优化软件
  • 做终端客户网站百度灰色词排名代发
  • 买程序的网站博客可以做seo吗
  • 汕头市城市建设总公司网站百度宣传做网站多少钱
  • 公司让我做网站负责人百度扫一扫
  • 做o2o平台网站需要多少钱seo的工作流程
  • wordpress index.php on line 17昆明seo关键字推广
  • 聊城网站推广动态aso推广平台
  • 网站主页样式昆明网站seo公司