官术网_书友最值得收藏!

  • 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:

  1. Open your block's directory.
  2. Create a new file called view.css, if it doesn't exist.
  3. Add a rule to change the background color of the site to black:
    body {
      background: #000 !important;
    }
  4. Visit the page containing your block.
  5. 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
主站蜘蛛池模板: 西峡县| 营口市| 越西县| 永州市| 耒阳市| 察雅县| 西城区| 长白| 巫溪县| 临城县| 舒兰市| 垦利县| 阳西县| 福贡县| 浑源县| 高雄县| 泽普县| 邳州市| 三穗县| 关岭| 大庆市| 平潭县| 西贡区| 汝阳县| 洛扎县| 日喀则市| 彭泽县| 达日县| 略阳县| 崇左市| 中江县| 郯城县| 长垣县| 龙胜| 同江市| 上杭县| 定安县| 蒙山县| 安达市| 德令哈市| 普定县|