- concrete5 Cookbook
- David Strack
- 191字
- 2021-08-13 16:16:01
Including CSS in the block view
Developers and designers working on custom concrete5 block types can have a CSS file automatically included. In this recipe, we will automatically include a CSS file that will change our background to black.
Getting ready
We are still working with the block that was created earlier in the chapter. Please make sure that block exists, or adapt this recipe to suit your own concrete5 environment.
How to do it...
The steps for including CSS in the block view are as follows:
- Open your block's directory.
- Create a new file called
view.css
, if it doesn't exist. - Add a rule to change the background color of the site to black:
body { background: #000 !important; }
- Visit the page containing your block.
- The background should now be black!
How it works...
Just like it does with JavaScript, concrete5 will automatically include view.css
in the page's header if it exists in your block directory. This is a great way to save some time with styles that only apply to your block.
See also
- The Including JavaScript in block forms recipe
- The Including JavaScript in the block view recipe
推薦閱讀
- HTML5+CSS3+JavaScript從入門(mén)到精通:上冊(cè)(微課精編版·第2版)
- C語(yǔ)言程序設(shè)計(jì)習(xí)題解析與上機(jī)指導(dǎo)(第4版)
- Django開(kāi)發(fā)從入門(mén)到實(shí)踐
- 編譯系統(tǒng)透視:圖解編譯原理
- Visual Basic程序設(shè)計(jì)實(shí)驗(yàn)指導(dǎo)(第4版)
- The DevOps 2.4 Toolkit
- EPLAN實(shí)戰(zhàn)設(shè)計(jì)
- Spring快速入門(mén)
- Multithreading in C# 5.0 Cookbook
- Clojure for Machine Learning
- PrimeFaces Blueprints
- Deep Learning with R Cookbook
- C編程技巧:117個(gè)問(wèn)題解決方案示例
- C陷阱與缺陷
- C指針原理揭秘:基于底層實(shí)現(xiàn)機(jī)制