4
Hello! I don’t know if I could be very clear with the title of my question. But my question is with the following code:
<div id="newsletter" class="col-sm-12">
<div class="news-title">
<i class="fa fa-envelope hidden-xs hidden-sm"></i>RECEBA OFERTAS E LANÇAMENTOS NO SEU E-MAIL!
</div>
<div class="news-input">
<input type="hidden" name="source" value="ecommerce">
<input type="text" name="name_news" placeholder="Digite seu nome" class="form-control input-lg">
<input type="email" name="email_news" placeholder="Digite seu e-mail" class="form-control input-lg">
<span class="input-group-btn">
<button type="button" class="btn btn-lg btn-newsletter" id="newseltter_send" data-loading-text="ENVIANDO...">ENVIAR</button>
</span>
</div>
</div>
I want to be using margin-bottom:10px;
in .news-title
only if there is an element input[name="name_news"]
.
I know you can use jQuery to solve this, but I want to know if you can do it using CSS only. I tried using the following parameter:
#newsletter > .news-title ~ .news-input > input[name="name_news"]
But it did not work, because it gives the margin in the input element. I hope someone can help me with that, thank you :D
:has()
is an experimental selector with almost or no support for most (if not all) popular browsers.– Guilherme Nascimento
The intention was to actually use only CSS in this case. But if I can’t, I’ll have to use javascript by the way :/
– Leonardo Dias