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

  • 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
主站蜘蛛池模板: 巴林左旗| 广昌县| 玉屏| 昭平县| 青岛市| 台东县| 奉新县| 绥棱县| 勐海县| 阿城市| 绵竹市| 大埔区| 二手房| 梅河口市| 祁门县| 吴川市| 前郭尔| 河津市| 湘阴县| 巧家县| 山西省| 平顺县| 枣强县| 大厂| 沾益县| 喜德县| 柳州市| 汝州市| 富锦市| 阿坝| 武汉市| 茂名市| 和龙市| 同德县| 南阳市| 巫溪县| 洪泽县| 韩城市| 六安市| 雷山县| 阿荣旗|