Is it possible to set the equivalent of a src attribute of an img tag in CSS?

后端 未结 25 2767
借酒劲吻你
借酒劲吻你 2020-11-22 09:30

Is it possible to set the src attribute value in CSS? At present, what I am doing is:


25条回答
  •  南方客
    南方客 (楼主)
    2020-11-22 10:16

    I would add this: background image could be also positioned with background-position: x y; (x horizontal y vertical). (..) My case, CSS:

    (..) 
    #header {
      height: 100px; 
      background-image: url(http://.../head6.jpg); 
      background-position: center; 
      background-repeat: no-repeat; 
      background-color: grey; 
      (..)
    } 
    (...)
    

提交回复
热议问题