CMS Development

Cristinaferza
Participant

White space when delete blog post image

Hello, I have a blog post template with some images, but if in one post I don't want to use one of these images and I delete it, it appears white space in the image gap.

I send some pictures of my problem.

Thank you

post-without-image.PNGwhitespace.PNG

 

0 Upvotes
1 Reply 1
Kevin-C
Recognized Expert | Partner
Recognized Expert | Partner

White space when delete blog post image

Hey @Cristinaferza 

 

I'm assuming that the wrapping html for the image has a min-height in the css or line-height. You could use a conditional to show or hide the image. If placed a little pseudo code below to illustrate. (this is not working hubl)

{% if !image %}
  {# do nothing #}
{% elif %}
  <div class="……
{% endif %}

 

There is also potential to use an attribute selector on img tags with CSS:

img[src=""] {
   display: none;
}

 

EDIT: Deleted a option that isn't supported yet

Kevin Cornett - Sr. Solutions Architect @ BridgeRev