Is class attribute work with span tag | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 3

Is class attribute work with span tag HTML file: <!DOCTYPE html> <html> <head> <title>Registration form</title> </head> <body bgcolor="burlywood"> <h1 align="center">Registration form</h1> <form action="https://" target="_blank"> first name: <br /> <input type="name" placeholder="enter your name" /> <br /> last name: <br /> <input type="name" placeholder="enter your last name"/> <br /> <br /> gender selection: <br /> <input type="radio" name="gender" />Male <br /> <input type="radio" name="gender" />Female <br /> <br /> email: <br /> <input type="email" placeholder="enter your email address"/> <br /> password: <br /> <input type="password" placeholder="enter your password" /> <br /> <br /> you favourite animals:<br /> dog<input type="checkbox" value="dog" /> <br /> cow<input type="checkbox" value="cow" /> <br /> cat<input type="checkbox" value="cat" /> <br /> <br />message: <br /> <textarea placeholder="enter your message" text></textarea> <br /> <br /> <span class="center"><input type="submit" value="SUBMIT" align="center"/></span> </form> </body> </html> CSS file: .center{ text-align:center; } But submit button didn't show in the center. Please answer me.

13th May 2019, 3:54 AM
jay goti
jay goti - avatar
2 Respuestas
+ 3
jay goti As span tag is an inline element you can't position it to center! Use display: block; property to make span a block level element and then center it! ūüėá
13th May 2019, 4:49 AM
Arb Rahim Badsa
Arb Rahim Badsa - avatar
+ 2
Just as Jay Goti said, it's an inline element so change it's display to block before you center it. .center { display: block; width: 100%; text-align: center; margin: 0 auto; }
13th May 2019, 5:03 AM
Clement Sam