HTML CSS Exercise: CSS Button
Solution:
HTML Code :
Explanation:
- The HTML file starts with the standard document structure.
- Inside the <head> section, a title is defined for the HTML page.
- Within the <style> tag, CSS rules are defined for styling the button element.
- The button element is targeted, and various CSS properties are applied to it to define its appearance.
- Width, padding, background color, border color, text color, and font weight are set to create the visual style of the button.
- Border radius properties are used to give rounded corners to the button.
- Different vendor prefixes (-moz-, -webkit-, -khtml-) are used to ensure compatibility with various browsers.
- Text alignment and vertical alignment properties are set for proper positioning of the button text.
- A transparent border is defined for the button.
- Finally, the button element is used in the HTML body with the text "Subscribe Now" inside it.
Live Demo :
Supported browser
![]() |
![]() |
![]() |
![]() |
![]() |
Yes | Yes | Yes | Yes | Yes |
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.