Reputation: 39
I am trying to make a button
in some HTML code for a small web app I made, however my button
should say "ok" but the button
itself is too small and doesn't display the "ok" completely.
Am I missing something for the span
?
How can I increase the size of the button
to be a bit larger and display all of the "ok"?
<center>
<br>
<br>
<span id="accept_button" style="display:none;"><button onclick="task.accept_choice();"><h3>ok</h3></button></span>
<span id="next_button" style="display:none;"><button onclick="task.next_trial();"><h3>ok</h3></button></span>
</center>
Upvotes: 0
Views: 39
Reputation: 60553
the problem is because you are using span
which is an inline element, so you had to set display:block
, but I advise you to:
use div
to wrap the button
you don't need nothing as child of button
to wrap the text, because you can style the button
don't use center
tag because it is already deprecated, instead style an element using CSS
<div id="accept_button">
<button onclick="task.accept_choice();">ok</button>
</div>
<div id="next_button">
<button onclick="task.next_trial();">ok</button>
</div>
NOTE: In HTML5, you can have span
as parent of h3
(same goes for button
) but not in HTML4
Permitted parent elements
any element that can contain flow elements, hgroup
phrasing elements or
a
orp
orhr
orpre
orul
orol
ordl
ordiv
orh1
orh2
orh3
orh4
orh5
orh6
orhgroup
or address orblockquote
orins
ordel
orobject
ormap
ornoscript
orsection
ornav
orarticle
oraside
orheader
orfooter
orvideo
oraudio
orfigure
ortable
orform
orfieldset
ormenu
orcanvas
ordetails
And span
/button
are one of the phrasing elements
Upvotes: 3