- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2020
07:13 AM
07-05-2020
07:13 AM
I am trying to add Bootstrap as external style sheet. My default_head_blocks.xml is like below.
<?xml version="1.0"?> <!-- /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <head> <meta name="viewport" content="width=device-width, initial-scale=1"/> <link rel="stylesheet" type="text/css" src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous" src_type="url" /> <css src="css/custom.css"/> <css src="css/fixed_css.css"/> </head> </page>
But I am getting error like below while I am trying to browse my site.
Solved! Go to Solution.
Labels:
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2020
07:39 AM
07-05-2020
07:39 AM
Hi @foysal,
Please remove crossorigin attribute from link element in xml file.
Check this:
https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/css-topics/css-themes.html
Thanks!
Problem Solved! Click Kudos & Accept as Solution!
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2020
07:39 AM
07-05-2020
07:39 AM
Hi @foysal,
Please remove crossorigin attribute from link element in xml file.
Check this:
https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/css-topics/css-themes.html
Thanks!
Problem Solved! Click Kudos & Accept as Solution!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2020
01:17 PM
07-05-2020
01:17 PM
Re: Add Bootstrap as external style sheet
Try updating your default_head_blocks.xml with below code :
<?xml version="1.0"?> <!-- /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <head> <meta name="viewport" content="width=device-width, initial-scale=1"/> <link rel="stylesheet" type="text/css" src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" src_type="url" /> <css src="css/custom.css"/> <css src="css/fixed_css.css"/> </head> </page>
Problem Solved ? Click on 'Kudos' & Accept as Solution !
