Whilst there has been some input on this, the question of width control of <input>
remains open.
This problem relates to a WordPress site, but is reproducible in a very trivial form.
Context: I have a checkbox controlled, CSS nested heading/text toggle system. The checkbox is hidden and it all works well, except that I have no control over the checkbox width. Unless overridden it is about 14px wide - I want it full div width; I cannot achieve that. (The checkbox must sit over the following heading, hence position: absolute;)
The actual checkbox cannot be resized, but it's clickable area can be: I am interested in the click area width.
The WP page HTML is this (some bits truncated for brevity)
<div id="left-area">
<article id="post-399" class="et_pb_post ...">
<h1></h1>
<p class="post-meta"></p>
<div class="entry-content">
<div class="nested-toggle">
<input type="checkbox" checked="">
<h2>Heading</h2>
Theme CSS styling on "left-area" sets the width at 712px. However, if the <input>
is given width:100%; it comes out with a width of 968px, which is not that of the <div id="left-area">
but in fact that of an outer (styled by div.container {...}
to give width = 968px).
The effect can be reproduced with the following minimal example
<div class="leftside">
<input type="checkbox" checked><i></i>
<h2>a Heading</h2>
</div>
with styling
div.leftside {width:900px;}
input[type="checkbox"] {
position: absolute;
width: 50%;
}
This was all done with Firefox (current version) and the minimal example checked at codepen.io.
I'm relatively new (again) to this; I have I done something stupid?
What's going wrong, and how can I set <input>
to have the right width?
Thx!
PS One of FF or WP seems to add </input>
after my <input>
; technically that seems to be invalid HTML as it causes an error when validating at W3C but it doesn't seem to affect the rendering behaviour.