• Is there any reference page for the syntax of the CSS used in the code editor of blocks? I finally figured out I can change things the way I want them, but the CSS code in the code editor uses “” and {} in ways that are idiosyncratic and I know that if you mess something up, there’s no second chance. So is there a reference?

    I am so happy I can finally kill all those giant padding and margins that look like crap AND maybe even control sizes of things? Dare I dream that my blog will look how I want it to again instead of how designers say it is supposed to look???

    Google-fu keeps showing me ways to add Code to Blocks which is not what I want.

    • This topic was modified 2 years, 3 months ago by Yui. Reason: moved to "developing with wordpress"
    • This topic was modified 2 years, 3 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic
Viewing 4 replies - 1 through 4 (of 4 total)
  • Can you share an example of what you mean? I’m not familiar with any CSS that uses those characters in idiosyncratic ways.

    Thread Starter Walton

    (@walton)

    I guess I should have copied it. It was all over one post with blocks so I assumed all blocks look like this. But here’s some weird html with “” and {} in it. And the whole thing is commented out with <– –> so how does it even get read?
    <!– wp:image {“align”:”center”,”id”:1370,”width”:366,”height”:512,”linkDestination”:”custom”} –>
    The style thing was the same “” around everything and {} around everything totally weird.

    This isn’t CSS. It’s data for the block serialised as JSON and stored in an HTML comment. It’s how data that can’t be pulled directly from the HTML is stored so that it can be read when the block is loaded in the editor. There’s an explanation available here and in subsequent articles.

    If you have a block that has spacing defined in this data, then editing that value directly is not going to actually change spacing. It can’t actually affect anything, because it’s not CSS. All it would do is allow the editor to read that value and use it to do something else, like add some inline CSS, or a custom class.

    As to whether you can control spacing between blocks etc, this depends entirely on the theme. You’ve always been able to change this with your own CSS in Appearance > Customize > Additional CSS, but whether simpler tools are available in the editor to control this is entirely dependent on the theme. WordPress 5.7 introduced some features to allow control over spacing from within the editor, but themes still need to opt into this.

    Thread Starter Walton

    (@walton)

    I know this isn’t CSS. As I said, I can’t find the CSS but this is the kind of weird crap I see.This is the kind of thing the CSS Looked like though. “style” {“font-family”{sans-serif}}”

    Weird crap like that. It was probably something similar. Stupid me thought the code editor was there in case normal human beings wanted power over their blogs! I thought it would let me edit code or something LOL!

    In the before times, you could add space between things in a post by using <br> or by using inline styles, no problem. I was hoping the code editor gave me that freedom back but I see now that I have no right to decide what my blog looks like!

    I don’t want to change the spacing between every block simultaneously. I want to be able to add padding or margins to particular blocks at particular times. Like when you group blocks, it adds all this extra padding or margin that looks like crap! I don’t see how taking control away from people is a good thing!

    If I had the time to get a new theme and redo everything, I’d spend that time learning a new blogging system honestly!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘The CSS code used in the block code editor’ is closed to new replies.