

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Set the width of the element in HTML
Use the width attribute in HTML to set the width of an element. You can use the attribute with the following elements − <canvas>, <embed>, <img>, <input>, <video>, etc.
Example
You can try to run the following code to implement width attribute in HTML −
<!DOCTYPE HTML> <html> <body> <video width="300" height="200" controls autoplay> <source src = "/html5/foo.ogg" type = "video/ogg" /> <source src = "/html5/foo.mp4" type = "video/mp4" /> Your browser does not support the video element. </video> </body> </html>
Output
- Related Questions & Answers
- How to set the width of an element in JavaScript?
- Set the width of an element to 75% in Bootstrap
- Set the width of an element to 25% in Bootstrap
- Set the width of an element to 100% in Bootstrap
- Set the width of an element to 50% in Bootstrap 4
- How to set the name of the element in HTML?
- How to set the maximum width of an element with JavaScript?
- How to set the minimum width of an element with JavaScript?
- How to set the width of the outline around an element with JavaScript?
- Set min-width and max-width of an element using CSS
- Set the name of the form the element belongs to in HTML?
- Set the width of the outline with CSS
- Change the width of element using CSS
- How do we set the type of element in HTML?
- How to set the width of an element's border with JavaScript?
Advertisements