Blogger news ticker css code
Here is an example of CSS code for a blogger news ticker:
/* News Ticker Styles */
.news-ticker {
position: relative;
width: 100%;
height: 30px;
background-color: #f0f0f0;
border: 1px solid #ccc;
border-radius: 5px;
padding: 10px;
font-size: 14px;
font-family: Arial, sans-serif;
overflow: hidden;
}
.news-ticker ul {
list-style: none;
margin: 0;
padding: 0;
position: relative;
}
.news-ticker li {
display: inline-block;
margin-right: 10px;
padding: 5px;
background-color: #fff;
border: 1px solid #ccc;
border-radius: 5px;
font-size: 14px;
font-family: Arial, sans-serif;
}
.news-ticker li:last-child {
margin-right: 0;
}
.news-ticker li:hover {
background-color: #f2f2f2;
cursor: pointer;
}
.news-ticker li:active {
background-color: #ccc;
}
/* Animation Styles */
.news-ticker ul {
animation: news-ticker 10s linear infinite;
}
@keyframes news-ticker {
0% {
transform: translateX(0);
}
100% {
transform: translateX(-100%);
}
}
This code creates a basic news ticker with a list of items that scroll horizontally. You can customize the styles to fit your needs.
Here's an example of how you can use this code in your Blogger template:
- Add the following code to your Blogger template, just before the closing
</head>
tag:<style> /* Add the CSS code above here */ </style>
- Create a new widget in your Blogger dashboard and add the following code:
<div class="news-ticker"> <ul> <li>News Item 1</li> <li>News Item 2</li> <li>News Item 3</li> <!-- Add more news items here --> </ul> </div>
- Customize the news items by adding more
li
elements to the list.
Note: You can adjust the animation speed and duration by modifying the animation
property in the CSS code. For example, you can change 10s
to 5s
to make the animation faster.