Simple Card Holders Using CSS and HTML without Bootstrap

Tejaksha K
2 min readFeb 28, 2023

--

In web development, a card holder is a popular user interface element that’s used to display a collection of items in a visually appealing way. A card holder typically consists of a set of rectangular cards that are arranged in rows and columns. Each card contains an image or other visual content, along with some text.

In this tutorial, we will learn how to create a card holder without using Bootstrap, a popular front-end framework that provides pre-built components for building responsive web pages. Instead, we will write our own CSS code to create a simple and elegant card holder.

We will start by creating a container element that will hold our card holder. We will set its width to 100% and its max-width to 960px to ensure that it’s mobile-responsive. We will also center it using the margin property.

<div class="container">
<!-- card holder elements will go here -->
</div>
.container {
width: 100%;
max-width: 960px;
margin: 0 auto;
}

Next, we will create a class for our card holder. We will set its width to 280px and its height to 380px to create a rectangular shape. We will also add some padding to create some space between the image and the text. We will set the background color to white and add some border radius to create rounded corners.

<div class="container">
<div class="card-holder">
<img src="path/to/image.jpg" alt="Image description">
<h3>Card title</h3>
</div>
<!-- repeat card-holder elements as needed -->
</div>
.card-holder {
width: 280px;
height: 380px;
padding: 10px;
background-color: white;
border-radius: 10px;
}

Finally, we will add some images and text to our card holder using HTML. We will use the img tag to display the image and the h3 tag to display the text. We will also use the alt attribute to provide a description of the image for accessibility purposes.

<div class="container">
<div class="card-holder">
<img src="path/to/image.jpg" alt="Image description">
<h3>Card title</h3>
</div>
<div class="card-holder">
<img src="path/to/image.jpg" alt="Image description">
<h3>Card title</h3>
</div>
<!-- repeat card-holder elements as needed -->
</div>

By following these simple steps, we can create a beautiful and responsive card holder without using any pre-built components. This approach gives us more control over the design and ensures that our website is optimized for all devices, including mobile phones and tablets.

You’re welcome! I’m glad I could help you with our blog post. Don’t hesitate to reach out if you have any other questions or need further assistance. Keep up the great work! ❤️

--

--

Tejaksha K

Reach me at https://tinyurl.com/56svjz36 I'm a Full Stack Developer & Cloud Expert with experience in Google Cloud Platform & AWS.