less hack 兼容_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:37:21
Original
1162 people have browsed it

less hack 兼容

css做兼容是在所难免的,那么用less写css代码时怎样hack呢?倘若用css的方法直接在后面写上类似“\9”编译是要报错的。下面是我尝试的两个小方法仅供参考:

1.  先定义一个变量“/*\**/” 在hack时加上这个变量编译就不会报错:

@hack: ~"/*\**/";#box {     background-color@{hack}: blue\9; }
Copy after login

编译后的css代码为:

#box {    background-color/*\**/: blue\9;}
Copy after login

2.第二个方法原理与第一个类似,只是把hack符号“\9”自定义成变量,加到less代码的尾部,这样在编译时就能生成完整地css hack代码,也不会报错。

@hack:~"\9";#box{    background-color:blue@hack;}
Copy after login

编译后的css代码是大家最熟悉的了:

#box{    background-color:blue\9;}
Copy after login

 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template