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

  • 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
主站蜘蛛池模板: 彭水| 平阴县| 苗栗县| 灵寿县| 宜君县| 安义县| 合水县| 项城市| 花莲县| 建宁县| 景洪市| 蓬莱市| 毕节市| 玉树县| 七台河市| 靖西县| 兴安县| 张掖市| 建昌县| 长垣县| 东源县| 阆中市| 即墨市| 兴宁市| 福州市| 阜阳市| 阿城市| 苏州市| 白山市| 曲阳县| 紫云| 福清市| 常熟市| 微博| 清涧县| 九寨沟县| 乌鲁木齐市| 关岭| 四川省| 靖安县| 行唐县|