Is there a way to change the width of the <code> HTML tag?
I noticed that any modification of the <code> style with respect to its width has no effect. It always seems to be set to "auto".
I'm just trying to write code inside a <code> tag (this tag is required due to some known iBooks errors), which is 100% wide. One way is to put the <code> inside the <div> , which has a 100% background style. This works fine, but I have to deal with a few hundred <code> tags ... That's why I would rather just change the width of the <code> .
Any thoughts? Thanks.
+8
Yeseanul
source share2 answers
Items
<code> are inline elements. Setting the height or width on them does not affect their size.
Use display:inline-block ::
code { display: inline-block; width: 100px; /* Whatever. The <code> width will change */ } +7
Rob w
source shareAdd display: block or inline-block as required by the code element. Rest should work as planned.
See example
+3
Starx
source share