- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to set the bottom margin of an element with JavaScript?
Use the marginBottom property in JavaScript, to set the bottom margin.
Example
You can try to run the following code to set the bottom margin of an element with JavaScript −
<!DOCTYPE html> <html> <body> <p id="myID">This is demo text.</p> <button type="button" onclick="display()">Set bottom margin</button> <script> function display() { document.getElementById("myID").style.marginBottom = "95px"; } </script> </body> </html>
Advertisements