Giter Club home page Giter Club logo

blog's People

Contributors

ok-jose avatar

Watchers

James Cloos avatar  avatar

blog's Issues

css attr()表达式结合伪类中content属性

attr() 官方解释

The attr() CSS function is used to retrieve the value of an attribute of the selected element and use it in the style sheet. It can also be used on pseudo-elements, in which case the value of the attribute on the pseudo-element's originating element is returned.

翻译过来就是:

CSS表达式 attr() 用来获取选择到的元素的某一HTML属性值,并用于其样式。它也可以用于伪元素,属性值采用伪元素所依附的元素。

attr() 表达式可以用于任何CSS属性。

因此我们可以在我们可以把一些样式属性与页面上可变量结合在一起,少了些class判断。

<div class=",mul-source" data-shopnow="SHOP NOW"></div>

.mul-source:after { display: block; content: attr(data-shopnow); position: absolute; }

解决在TypeScript 中 import JSON 错误警告

最近在写TS项目时,导入json文件时,vscode一直报这个错误:
[ts] Cannot find module './cities.json'. Consider using '--resolveJsonModule' to import module with '.json' extension
然后晚上找了找解决方案:

  1. 新建一个.d.ts文件
  2. declare json模块:
    declare module '*.json' { const value: any export default value }

然后就可以正常使用了: import cities from './cities.json'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.