Boostrap news widget
A Bootstrap news widget! Here's a basic example of how you can create a news widget using Bootstrap:
HTML
<div class="news-widget">
<h2>Latest News</h2>
<ul class="list-group">
<li class="list-group-item">
<h4><a rel="nofollow" target="_blank" href="#">News Title 1</a></h4>
<p>News summary 1</p>
<span class="date">March 10, 2023</span>
</li>
<li class="list-group-item">
<h4><a rel="nofollow" target="_blank" href="#">News Title 2</a></h4>
<p>News summary 2</p>
<span class="date">March 8, 2023</span>
</li>
<li class="list-group-item">
<h4><a rel="nofollow" target="_blank" href="#">News Title 3</a></h4>
<p>News summary 3</p>
<span class="date">March 5, 2023</span>
</li>
</ul>
</div>
CSS (using Bootstrap classes)
.news-widget {
background-color: #f9f9f9;
padding: 20px;
border: 1px solid #ddd;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.list-group {
list-style: none;
padding: 0;
margin: 0;
}
.list-group-item {
padding: 10px;
border-bottom: 1px solid #ddd;
}
.list-group-item:last-child {
border-bottom: none;
}
.date {
font-size: 14px;
color: #666;
}
JavaScript (optional)
// Add a fade-in effect to the news widget
$(document).ready(function() {
$('.news-widget').fadeIn(1000);
});
This is a basic example of a news widget using Bootstrap. You can customize it to fit your needs by adding more styles, modifying the HTML structure, or adding interactivity using JavaScript.
Here's a breakdown of the code:
- The
.news-widget
div contains the news widget's content, including a heading, list of news items, and a date. - The
.list-group
class is used to style the list of news items as a group of items. - The
.list-group-item
class is used to style each individual news item as a list item. - The
.date
class is used to style the date of each news item. - The JavaScript code adds a fade-in effect to the news widget when the page loads.
You can customize the appearance and behavior of the news widget by modifying the CSS and JavaScript code. For example, you could add more styles to the .news-widget
div to change its background color, padding, or border. You could also add more JavaScript code to animate the news items or add interactivity to the widget.