Home > Article > Web Front-end > CSS web navigation buttons: Create diverse navigation button styles
CSS web page navigation button: To create diverse navigation button styles, specific code examples are required
Navigation button is one of the common elements in web pages, and it is very important to the overall web page. Style and user experience play a vital role. In order to add more interactivity and beauty to the web page, we can create diverse navigation button styles through CSS. This article will introduce some common navigation button styles and provide specific code examples for reference.
Flat Button
Flat button refers to a button style without three-dimensional effect and shadow effect. They usually have a simple, clean look and are suitable for modern and minimalist style web pages. The following is a code example for a flat button:
.flat-button { background-color: #3498db; color: #fff; padding: 10px 20px; border: none; border-radius: 4px; cursor: pointer; }
In this example, we use the background-color
and color
properties to define the background color and text color of the button , padding
attribute is used to set the padding of the button, border
attribute and border-radius
attribute are used to define the border style and rounded corners of the button, ## The #cursor attribute specifies the style of the mouse on the button as a hand shape.
Three-dimensional button adds a three-dimensional feel to the button by using shadow and gradient effects, making it look more layered and textured. Here is a code example for a three-dimensional button:
.3d-button { background: linear-gradient(to bottom, #3498db, #2980b9); color: #fff; padding: 10px 20px; border: none; border-radius: 4px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3); cursor: pointer; }In this example, we use the
linear-gradient attribute to create the gradient background color of the button,
box-shadowAttribute is used to add the shadow effect of the button. By adjusting the starting and ending colors of the gradient, different button effects can be achieved.
The floating button is a button style that floats above the content and is common in applications on mobile devices. They often have a rounded appearance and a prominent shadow effect, giving the impression of floating off the page. The following is a code example of a floating button:
.floating-button { background-color: #3498db; color: #fff; width: 60px; height: 60px; border-radius: 50%; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3); position: fixed; bottom: 20px; right: 20px; cursor: pointer; }In this example, we set the width and height of the button to 60px, and use the
border-radius attribute to define the shape of the button as Circle, add the shadow effect of the button through the
box-shadow property. Use the
position attribute to position the button in the lower right corner of the page.
The above is the detailed content of CSS web navigation buttons: Create diverse navigation button styles. For more information, please follow other related articles on the PHP Chinese website!