- This topic has 9 replies, 3 voices, and was last updated 3 years ago by
David.
-
AuthorPosts
-
March 15, 2023 at 5:28 am #2568424
twarrior
To make all page figures (img + figcaption) leave a space at the bottom (like paragraphs do), we have the following code:
/* margin img */ .entry-content figure[class*="image"] { margin-bottom: 40px; }But also we want to make some images “inline” with parragraphs similar to https://www.screencast.com/t/DNMw3PP1
For these images, we have try to specify an “ADDITIONAL CSS CLASS” called “float-image-left”.
and then in css we have:
/* imagen in-line con txt */ .float-image-left { float: left; padding: 0 15px 0 0; }The problem is that this additional class applies to the “img” (not the “figure”), and we need to be able to access the figure to indicate that in this case we want the margin-botton: 0px.
March 15, 2023 at 6:39 am #2568497David
StaffCustomer SupportHi there,
in the GenerateBlocks image block toolbar you can select Float Left.
So no need for the CSS, and it applies the styles to the figure elementMarch 15, 2023 at 8:27 am #2568741twarrior
Thanks David.
But in this case, with an “ADDITIONAL CSS CLASS” called “no-margin-bottom” and the next code, we should be able to set the margin, but we are not. We still need access to the “figure”, but the “Additional CCS Class” is applied to the “image”, not to the “figure”.
.no-margin-bottom { margin-bottom: 0px !important; }Allow me to make a observation from a user’s point of view (I’m not a CSS expert, I don’t even have advanced knowledge).
If the structure of “GB image” block is as follows:
<figure> <img> <figcaption></figcaption> </figure>It seems strange that the “ADDITIONAL CSS CLASS” applies to the “image” and not the “figure”.
I think the “ADDITIONAL CSS CLASS” of the “image block” should apply to the Figure, and then we could select with css either the whole Figure, or the child “Image”, or the child “Figcaption”, Isn’t it?
March 15, 2023 at 9:28 am #2568805Ying
StaffCustomer SupportYou can always target the figure using a selector like
figure:has(.no-margin-bottom).March 15, 2023 at 1:16 pm #2569071twarrior
Thanks ying, but not sure about the Browser Compatibility of this selector…
And if we want to select de Figcaption?
PD: What do think about that the “ADDITIONAL CSS CLASS” of the “image block” should apply to the Figure, instead of the Image?
March 15, 2023 at 3:16 pm #2569146Ying
StaffCustomer Supportbut not sure about the Browser Compatibility of this selector…
Most mainstream browsers support
:has()CSS, except Firefox.And if we want to select de Figcaption?
It’s not a problem, just use this selector:
figure:has(.no-margin-bottom) figcaption.What do think about that the “ADDITIONAL CSS CLASS” of the “image block” should apply to the Figure, instead of the Image?
When we create the GB image block, we actually spend a lot of time discussing this feature, and in the end we all agree that adding to the image itself is the better choice.
March 16, 2023 at 3:04 am #2569625twarrior
First of all, I am grateful for your explanation.
We prefer to avoid using the “has” selector if it is “too new” and not “fully” compatible.
We think that a more compatible solution would be to create a container block (which contains the figure and the parragraph) with the additional class “float-image” and the following code:
.float-image figure { margin: 0 5px 0 0 !important; }or
.float-image figcaption { background-color: #000 !important; }PS: if you consider it appropriate, a proposal for future versions could be that in the “image” block, an additional class could be added to the “image” and another one to the “figure” (or select if we want the class to the “image” or to the “figure”)
March 16, 2023 at 8:13 am #2570095David
StaffCustomer SupportYeah it is something we looked at perviously ie. having 2 CSS classes.
But we intend to make thefigurean editable ( Container ) block in the near future so you will be able to customize that directly if you want to.March 16, 2023 at 9:42 am #2570175twarrior
That´s better! Great!
March 17, 2023 at 3:18 am #2570825David
StaffCustomer SupportYou’re welcome
-
AuthorPosts
- You must be logged in to reply to this topic.