Using LESS variable to control url

The variable in LESS is use also to control url: path or all address. Look at the LESS code:

@url-path : "images/";

h3 {
    background: url( "@{url-path}/LESS.png" );

You may assign to variable url as string. It may be all path or part of its as in our example. The value from this variable we get through use in url string sign ‘@’ and name of variable in curly brackets.
See HTML code:

<!DOCTYPE html>
        <link rel="stylesheet" href="myStyle.css"  type="text/css" >
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <h1>My favorite animals</h1>
        <p>and others animals</p>


In HTML file header level 3 has background as image: LESS.png.

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.