D
D
Dmitry Kamyannoy2015-06-22 08:17:22
Drupal
Dmitry Kamyannoy, 2015-06-22 08:17:22

How to remove empty divs?

Good morning wt. Forum users are gurus. The question for you may be simple, but I did not ask such a question. Often at a verst I come across the fact that without filling some field it is displayed empty on the page, and if God forbid it needs to be styled like that, then you have to use the :empty pseudo-element, but agree that this is not Drupal-style, right? There should be nothing on the page other than the .
Attached image
9fec2d2d86da4a7ba34f8f5dc20f8b7c.jpg
P.S. The image turned out to be small, so I'm attaching a link to the full version
joxi.ru/V2VnD4Rs4kyG2v
P.S.S. To put it simply: empty .field-content tags in any of the empty fields.
Thank you very much. =)

Answer the question

In order to leave comments, you need to log in

4 answer(s)
I
Izbaskhan Kabilgakov, 2015-06-25
@redfieldone

In the settings of each field there is an item "Behavior in the absence of results". Check the box "Hide when empty"
3e5025df8bc2497ba3ee57db5bb462c5.png

D
Drupby, 2015-06-22
@drupby

The fields are displayed using a view, respectively, in the settings of this view, you can either in the field settings in the "BEHAVIOR WITH NO RESULTS" check the checkbox "Hide when empty", or in the settings for the output format of the view, select "Hide empty fields" in the settings for the fields (in this case it will work for all empty fields)

J
jobsdata, 2015-06-22
@jobsdata

What do these empty divs do to you?
Try digging into field.tpl.php. I think you can write a condition there, if the field contains something, then display it, if not, then do not display it.

A
andead, 2015-06-22
@andead

In the views settings, each field has an option "Hide if empty"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question