K
K
koshotayl2020-12-04 10:23:07
1C-Bitrix
koshotayl, 2020-12-04 10:23:07

How to include css file in bitrix?

There is a page that requires its own styles (body, container, etc.), the previous developer just wrote styles in style for index.php, attention to the question: how to connect styles to index.php ?
Or how to include styles in the template so that they do not conflict?
Or create a separate template? (there are not many styles, the page is simple, like 404)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Emelyanov, 2020-12-04
@koshotayl

https://dev.1c-bitrix.ru/api_d7/bitrix/main/page/a...

<?
 use Bitrix\Main\Page\Asset; 
 Asset::getInstance()->addJs('/путь/скрипт.js'); 
 Asset::getInstance()->addCss('/путь/стиль.css'); 
 Asset::getInstance()->addString('<meta itemprop="name" content="Название сайта"/>'); 
?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question