Link to stylesheet etc.

How to link to your stylesheets in your theme

Support-billede
By Morten Vadskær
more than 2 weeks ago
Approx. 1-2 minutes

When you link to your stylesheets or javascript it is important that you use the <{$theme_url}> variable to get the correct address.

If you use slashes in the address on your products or landing pages etc. you will experience problems with loading a stylesheet if you just link via

<link rel="stylesheet" type="text/css" href="css/style.css" />

Because if you are on http://example.com/bluser/t-shirt your stylesheet will not be loaded and your page will not look correct.

That's why you need to use:

<link rel="stylesheet" type="text/css" href="<{$theme_url}>/css/style.css" />

This website uses cookies.

We use cookies to personalize content and ads, provide social media features, and analyze our web traffic.

Information about your use of our website is also shared with our partners within social media, advertising, and analysis, who may combine them with other data from your interactions with their services.

Read more about our cookies