Jump to content

Ability to add css classes to blocks


Steve Bullman

Recommended Posts

Posted

Someones probably going to tell me this already exists, or theres an obvious work around but...

It would be really handy for people like myself who can just about work their way around css to have the ability to add a css class when creating a block, much like most of the wordpress page builders allow.

Posted

Blocks all have a unique 'blockid' attribute, which you can use in CSS to target that block. For example:

[data-blockid="app_gallery_albums_lqslwgew6"] {
	background: red;
}

You can find that ID by using web inspector to select the block on the page and looking at the DOM. That line above matches a specific block; if you have multiple blocks of the same type, you could target them all by doing (note the ^=)

[data-blockid^="app_gallery_albums_"] {
	background: blue;
}

 

Posted

Thanks for the quick response Rikki.  Ok, I can just about manage those instructions.  Been fiddling for ages trying to add css to blocks, some have worked, some haven't...some have applied the css to every block.  This is a big help, thanks

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...