search

Home  >  Q&A  >  body text

javascript - background:url problem in less

background: url(${@http}/img/icon/daorug@2x.png) no-repeat center 3rem / auto 25%;

@http is a variable
It would be unrealistic to write it this way, and there would be no analysis!

Ask how to do?

ringa_leeringa_lee2819 days ago636

reply all(2)I'll reply

  • 淡淡烟草味

    淡淡烟草味2017-05-19 10:32:55

    I found the answer, it should be background: url('@{http}/img/icon/daorug@2x.png') no-repeat center 3rem / auto 25%;

    reply
    0
  • 为情所困

    为情所困2017-05-19 10:32:55

    The calling method is wrong, don’t use the dollar sign

    @http: http://www.yoursite.com;   // 对变量@http的定义, 习惯上写在less文件开头
    
    background: url(@http/img/icon/daorug@2x.png) no-repeat center 3rem / auto 25%;

    reply
    0
  • Cancelreply