If an element with the class ".has_padding" does not have any text content, it should be set to "display:none;". However, those elements with text inside should remain visible.
Below is some code where I have styled the elements to demonstrate the issue. (I am trying to remove the visible #DDD-colored padding if the element is empty.)
Please note that JQuery has been included for easy execution of the code.
<!doctype html>
<html>
<head>
<title>Demo</title>
<style>
.myBox {
border: 2px solid #BBB;
margin: 20px 0;
}
.has_padding {
padding: 10px 40px;
background: #DDD;
}
</style>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
</head>
<body>
<div class="myBox">
<div class="has_padding"></div>
</div>
<div class="myBox">
<div class="has_padding">I have text.</div>
</div>
<div class="myBox">
<div class="has_padding">I have text too.</div>
</div>
<script>
// your code here.
</script>
</body>
</html>