- 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
推薦閱讀
- GAE編程指南
- 案例式C語言程序設(shè)計(jì)
- 兩周自制腳本語言
- Java Web基礎(chǔ)與實(shí)例教程(第2版·微課版)
- JavaScript語言精髓與編程實(shí)踐(第3版)
- Developing Middleware in Java EE 8
- concrete5 Cookbook
- Cocos2d-x學(xué)習(xí)筆記:完全掌握Lua API與游戲項(xiàng)目開發(fā) (未來書庫)
- WordPress 4.0 Site Blueprints(Second Edition)
- 微服務(wù)架構(gòu)深度解析:原理、實(shí)踐與進(jìn)階
- 多媒體技術(shù)及應(yīng)用
- 計(jì)算機(jī)組裝與維護(hù)(第二版)
- PhoneGap 3.x Mobile Application Development Hotshot
- Building E-Commerce Solutions with WooCommerce(Second Edition)
- 亮劍ASP.NET項(xiàng)目開發(fā)案例導(dǎo)航