I have some rendered HTML (see below). I want the first span element to have a width of 300px.
<div style="display:inline-block">
<div id="songFields">
<div>
<label for="Description">Title</label>
<span class="k-input k-textbox selectText k-input-solid k-input-md k-rounded-md" style="">
<input class="selectText k-input-inner" id="Description" name="Description" value="Shy Boy" data-role="textbox" aria-disabled="false" autocomplete="off" style="width: 100%;">
</span>
<script>
kendo.syncReady(function() {
jQuery("#Description").kendoTextBox({
"value": "Shy Boy"
});
});
</script>
<span class="field-validation-valid" id="Description_validationMessage" style="padding-left:20px"></span>
</div>
<!-- Continued -->
</div>
</div>
</div>
I have created a very specific style rule to set the width at 300px.
#songFields > div > span.k-input.k-textbox {
width: 300px;
}
There happens to be another generic rule in a different css file:
.k-input,.k-picker {
margin: 0;
padding: 0;
width: 100%;
Chrome recognizes that my style rule applies to the element, but decides to make the width 100% due to the less explicit style rule! (See the picture from the Chrome dev tools)
If I go into kendo.common-bootstrap.css
and comment out the width:100%
rule then my rule applies. But my rule should apply anyway because my selector #songFields > div > span.k-input.k-textbox
is more explicit than .k-input, .k-picker
. Why would Chrome be applying the rule from less explicit selector?
I have tested this in Firefox, and Firefox is using my rule as I would expect. Is this a Chrome bug?