0

I'm struggling to remove or change an attribute of an element inside a form.

Here's my html:

   <div class="tab_nav_wrapper">
    <form method="#" action="#">
        <input name="task" type="hidden" value="task1" >
        <input class="tab_nav_button" type="submit" value="Button1" >
    </form>
    <form method="#" action="#">
        <input name="task" type="hidden" value="task2" >
        <input class="tab_nav_button" type="submit" value="Button2" >
    </form>
    <form method="#" action="#">
        <input name="task" type="hidden" value="task3" >
        <input class="tab_nav_button" type="submit" value="Button3" >
    </form>
</div>

<div class="tab_nav_wrapper">
    <form method="#" action="#">
        <input name="task" type="hidden" value="task1" >
        <input class="tab_nav_button" type="submit" value="Button1" >
    </form>
    <form method="#" action="#">
        <input name="task" type="hidden" value="task2" >
        <input class="tab_nav_button" type="submit" value="Button2" >
    </form>
    <form method="#" action="#">
        <input name="task" type="hidden" value="task3" >
        <input class="tab_nav_button" type="submit" value="Button3" >
    </form>
</div>

My css:

input[type=submit].tab_nav_button {
  min-width        : 72px;
  height           : 36px;
  margin-left      : 2px;
  color            : rgb(255, 255, 255);
  border           : none;
  background-color : blue;
  text-transform   : uppercase;
}

I want to remove the margin-left on every first input.tab_nav_button inside the wrapper(.tab_nav_wrapper)

I tried to use something like the first-child selector .. but no success. I don't wanna use a different class for the first element.

Thanks!

Madosa
  • 15
  • 3
  • 6
  • You are looking for the **first** `.tab_nav_wrapper`, however you should be looking for the first `form`. Use this selector: `.tab_nav_wrapper form:first-child .tab_nav_button { margin-left: 0; }` – LinkinTED Sep 14 '17 at 08:42
  • @LinkinTED thanks so much. Working fine ! – Madosa Sep 14 '17 at 08:56
  • `.tab_nav_wrapper form:first-child .tav_nav_button{margin-left:0px}` – Super User Sep 14 '17 at 09:02

0 Answers0