Tomas_Coox
(Tomas Coox)
October 18, 2015, 9:01am
1
Hi,
I have trouble hiding empty elements. Please se the two pages in my collection.
This one have video-URLs in the two video-fields in the CMS. Black ones up right.
http://programbolaget.webflow.io/artist/tobbe-trollkarl
And this one doesn’t.
http://programbolaget.webflow.io/artist/zillah-totte
How can I make the DIV’s disappear completely in the second one?
Regards,
Tomas
1 Like
bart
(Bartosz Kustra)
October 18, 2015, 7:21pm
2
Hey Tomas,
Welcome to our community :)
I hope you’ll enjoy it!
Regarding your question, the divs do not disappear entirely due to the fact that there is a padding on the video container. If you were to remove the padding from those nodes, then they will disappear entirely due to no content being in them :)
Tomas_Coox
(Tomas Coox)
October 19, 2015, 12:58pm
3
Yes, exactly. Problem is. I want that black border around the videos.
How do I accomplish that?
Really happy to have found Webflow and looking forward to take part in this vibrant community also. Thanx!
Tomas_Coox
(Tomas Coox)
October 19, 2015, 1:22pm
4
I think I’ve solved it. What do you think about browser-compatibility on this one.
Added this to custom HEAD-code.
<style>
div.videodiv:empty { display: none }
</style>
Tomas
2 Likes
bart
(Bartosz Kustra)
October 19, 2015, 4:12pm
5
Oh, great solution! Didn’t know about using :empty
! Good to know you’ve found solution :)
1 Like
zolointo
(zolointo)
October 19, 2015, 5:41pm
6
Tomas: Is there a similar solution for my question here? - CMS - hide element if value is null - CMS - Forum | Webflow
Problem would be that the field for the collection item would need to be tested for null, vs testing the contents of a div. Any ideas?
sabanna
(Anna)
October 19, 2015, 6:09pm
7
I think it should work, if during styling content, you will wrap that field with the div and then add this code to specific div class.
Tomas_Coox
(Tomas Coox)
October 19, 2015, 6:10pm
8
Yep, it can work. Otherwise you will have to use JS to get this going.
zolointo
(zolointo)
October 19, 2015, 6:32pm
9
Just found out I can’t even test. No paid subscription = no editing Head code. Oh well. I’ll wait for an official response in the other thread. Thanks for your quick repsonse.
Tomas_Coox
(Tomas Coox)
October 19, 2015, 7:01pm
10
Aah, bummer. No worries, glad to discuss it.