2016-05-05 2 views
-1

Ich habe diese CSS bekam:Warum wird mein linker Rand nicht auf meine Optionsschaltfläche angewendet?

.leftmarginbreathingroom { 
    margin-left: 8px; 
} 

... und HTML:

<div class="row"> 
    <div class="col-md-12"> 
     <h4 class="h4 sectiontext leftmarginbreathingroom">Generate and Email Reports</h4> 
    </div> 
</div> 

@* "On a specific day of the month" radio button and Day of month selection element *@ 
<div class="row"> 
    <div class="col-md-12"> 
     <input type="radio" id="groupRptGenerationAndSendingByDayOfMonth" class="leftmarginbreathingroom" value="day">On a specific day of the month: 
     <select id="dayofmonthselect" class="leftmarginbreathingroom"> 
      @foreach (String day in daysOfMonth) 
      { 
       <option id="[email protected](day) value=" day">@day</option> 
      } 
     </select> 
     <label> of each month</label> 
    </div> 
</div> 

@* "Based on a pattern" radio button and select elements *@ 
<div class="row"> 
    <div class="col-md-12"> 
      <input type="radio" id="groupRptGenerationAndSendingBasedOnAPattern" class="leftmarginbreathingroom" value="pattern">Based on a pattern 
      <select id="ordinalselect" class="leftmarginbreathingroom"> 
       @foreach (String ord in ordinalWeeksOfMonth) 
       { 
        <option id="[email protected](ord) value=" ord">@ord</option> 
       } 
      </select> 
      <select id="dayofweekselect"> 
       @foreach (String dow in daysOfWeek) 
       { 
        <option id="[email protected](dow) value="dow">@dow</option> 
       } 
      </select> 
      <label> of each</label> 
      <select id="weekormonthselect"> 
       @foreach (String pf in patternFrequency) 
       { 
        if (pf == "Month") 
        { 
         <option id="[email protected](pf)" value="@pf" selected="selected">@pf</option> 
        } 
        else 
        { 
         <option id="[email protected](pf) value="pf">@pf</option> 
        } 
       } 
      </select> 
    </div> 
</div> 

... und doch, obwohl der linke Rand auf das Element h4 angelegt wird, und das Auswahlelement es ist nicht an das Eingangsfunkelement angelegt:

enter image description here

Warum nicht? Wie kann ich den Radiobutton dazu bringen, mit den anderen Elementen auch in Pixelschritt nach Osten zu gehen?

Antwort

2

Versuchen Hinzufügen !important Ausnahme Code:

.leftmarginbreathingroom { 
    margin-left: 8px !important; 
} 
1

Eingabeelemente manchmal eine Standard-Randeinstellung haben. Irgendwo in Ihrem CSS könnte es ein

input { margin: 0 !important; } 

sein, die Ihre .leftmarginbreathingroom Regel aus, die in Wirkung verhindern würde. Um dem entgegenzuwirken, würde das Hinzufügen von !important zu Ihrer Regel funktionieren.