Margin CSS Respected During In-Context Editing (should not be?)
Permalink
I have an element with a margin-top: -32px that is defined outside the typography.css file, yet is effected by that margin when in-context editing. The result is that the element is driven almost all the way up and out of its red-bordered edit block.
My understanding was that the typography.css file was used to style in-conext editing, but other CSS files were not.
How do I keep that content within it's edit block while in-context editing?
concrete5 v5.6.1.2
My understanding was that the typography.css file was used to style in-conext editing, but other CSS files were not.
How do I keep that content within it's edit block while in-context editing?
concrete5 v5.6.1.2
adding margin like that from edit mode has always produced the same results for me as well. I got used to remembering what certain blocks were, and then simply moved to creating stacks for all of these areas that are messed up like this as an easy way to include a cobbled area on pages.
One possible solution is to have a 'c5-edit-mode' class show up on your template's <body> tag when in edit mode.
The above code would output the following HTML in viewing mode...
...and the following HTML in edit mode.
Then in your template's stylesheet you could say...
...and that element would be right where you want it.
Ah, isn't the answer to every problem... more CSS? :D
<?php $body_class = (Page::getCurrentPage()->isEditMode()) ? ' class="c5-edit-mode"' : ''; ?> <body<?php echo $body_class ?>>
The above code would output the following HTML in viewing mode...
<body>
...and the following HTML in edit mode.
<body class="c5-edit-mode">
Then in your template's stylesheet you could say...
.c5-edit-mode .element { margin-top: 0; }
...and that element would be right where you want it.
Ah, isn't the answer to every problem... more CSS? :D
EXCELLENT!! I'll have to put this to work sometime in the near future!!
Thanks! That looks like just the right work-around.
But does that suggest there's a bug to be fixed, or is that just how it is meant to work?
But does that suggest there's a bug to be fixed, or is that just how it is meant to work?