zjffun blog

Set Width to Fieldset Element Does Not Take Effect

更新于 写于 htmlcss

That may cause of the <fieldset> has min-inline-size: min-content by default. So we can set min-inline-size: 0 to make width take effect. Example:

html
<fieldset style="width: 10px; background: lightblue">
  <pre>xxxxxxxxxxxxxxxxxxxx</pre>
</fieldset>
<fieldset style="min-inline-size: 0; width: 10px; background: lightblue">
  <pre>xxxxxxxxxxxxxxxxxxxx</pre>
</fieldset>

See:

: The Field Set element - HTML: HyperText Markup Language | MDN