Skip to main content

Archive

Show more

Foundation CSS Close Button

Foundation CSS Close Button

The Close Button component in Foundation CSS provides a simple way to create dismissible elements, such as alerts, modals, or notifications. It typically appears as an "X" icon that users can click to close or dismiss the associated content. Here's how you can use the Close Button component:


1. Basic Close Button

To create a basic Close Button, simply add the .close-button class to an anchor (<a>) element.

Example markup:

<a href="#" class="close-button">×</a>

This will generate a simple "X" icon that users can click to close the associated content.


2. Customizing Close Button Size

You can customize the size of the Close Button by adding one of the following size classes: .tiny, .small, .large, or .expand.

Example markup:

<a href="#" class="close-button tiny">×</a>
<a href="#" class="close-button small">×</a>
<a href="#" class="close-button large">×</a>
<a href="#" class="close-button expand">×</a>

This will create Close Buttons with different sizes.


3. Customizing Close Button Color

You can also customize the color of the Close Button by adding one of the Foundation CSS color classes, such as .primary, .secondary, .success, .alert, or .warning.

Example markup:

<a href="#" class="close-button primary">×</a>
<a href="#" class="close-button secondary">×</a>
<a href="#" class="close-button success">×</a>
<a href="#" class="close-button alert">×</a>
<a href="#" class="close-button warning">×</a>

This will create Close Buttons with different colors.


Conclusion

The Close Button component in Foundation CSS offers a straightforward way to create dismissible elements in your web applications. By customizing the size and color of the Close Button, you can tailor its appearance to fit the overall design and user experience of your application.

Comments