This lightweight CSS3 code snippet helps you to create a breaking news ticker in your HTML web project. It creates a stylish news ticker and scrolls text vertically after a certain delay time.
You can use this news ticker to display headlines of the latest news, posts, or products on a webpage. You can easily customize the background color by adding a color class. Similarly, you can set the class for full-width or half-width of the news bar.
There are many code snippets available online or on many other blogs and websites, but everyone cannot optimize your blog or website, so you need some optimized code snippets. So now checkout out the code snippet for your blog and website that will give you all features for your desired code. Now grab the ready-to-use code and paste it where you want.
Table of Contents
Features:
- Light Weight.
- Pure CSS.
- Cross Browser.
- No JQuery Files.
- Fully Customizable.
- Responsive.
How To Create Breaking News Vertical Animated Ticker Using Pure HTML-CSS?
There are a few easy and understandable steps to achieve your desired functionality that we are gonna share below. Follow each step perfectly.
CSS:
<style type="text/css"> @import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro); @keyframes ticker { 0% {margin-top: 0} 25% {margin-top: -30px} 50% {margin-top: -60px} 75% {margin-top: -90px} 100% {margin-top: 0} } .news { box-shadow: inset 0 -15px 30px rgba(0,0,0,0.4), 0 5px 10px rgba(0,0,0,0.5); width: 350px; height: 30px; margin: 20px auto; overflow: hidden; border-radius: 4px; padding: 3px; -webkit-user-select: none } .full-width{ width: 100%; } .news span { float: left; color: #fff; padding: 6px; position: relative; top: 1%; border-radius: 4px; box-shadow: inset 0 -15px 30px rgba(0,0,0,0.4); font: 16px 'Source Sans Pro', Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; -webkit-user-select: none; cursor: pointer } .news ul { float: left; padding-left: 20px; animation: ticker 10s cubic-bezier(1, 0, .5, 0) infinite; -webkit-user-select: none } .news ul li {line-height: 30px; list-style: none } .news ul li a { color: #fff; text-decoration: none; font: 14px Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; -webkit-user-select: none } .news ul:hover { animation-play-state: paused } .news span:hover+ul { animation-play-state: paused } /* OTHER COLORS */ .blue { background: #347fd0 } .blue span { background: #2c66be } .red { background: #d23435 } .red span { background: #c22b2c } .green { background: #699B67 } .green span { background: #547d52 } .magenta { background: #b63ace } .magenta span { background: #842696 } .yellow {background : yellow} .yellow span {background : yellow} </style>
HTML:
<div class="news red full-width"> <span>Breaking News</span> <ul class="scrollLeft"> <li><a href="#">Text 1 - Short Description</a></li> <li><a href="#">Text 2 - Short Description</a></li> <li><a href="#">Text 3 - Short Description</a></li> <li><a href="#">Text 4 - Short Description</a></li> </ul> </div> <div class="news blue full-width"> <span>Events</span> <ul> <li><a href="#">Student Option Wednesday!</a></li> <li><a href="#">Student Parking @ CV</a></li> <li><a href="#">DCSD Express Check-In</a></li> <li><a href="#">Pay School Fees</a></li> </ul> </div> <div class="news green full-width"> <span>Latest News</span> <ul> <li><a href="#">Text 1 - Short Description</a></li> <li><a href="#">Text 2 - Short Description</a></li> <li><a href="#">Text 3 - Short Description</a></li> <li><a href="#">Text 4 - Short Description</a></li> </ul> </div> <div class="news magenta full-width"> <span>Latest News</span> <ul> <li><a href="#">Text 1 - Short Description</a></li> <li><a href="#">Text 2 - Short Description</a></li> <li><a href="#">Text 3 - Short Description</a></li> <li><a href="#">Text 4 - Short Description</a></li> </ul> </div> <div class="news yellow full-width"> <span>Latest News</span> <ul> <li><a href="#">Text 1 - Short Description</a></li> <li><a href="#">Text 2 - Short Description</a></li> <li><a href="#">Text 3 - Short Description</a></li> <li><a href="#">Text 4 - Short Description</a></li> </ul> </div>
Customization:
No need to customize it. Just copy-paste. Rest edit the code as per comments and need.
Troubleshooting the Errors:
Do it with concentration and patience. Check your all steps again and all codes or scripts. If you find any error you can contact us anytime via comment or better via email, We are always here to help you.
Final Words:
That’s all we have. We hope that you liked this article. If you have any problem with this code in your template then feel free to contact us with a full explanation of your problem. We will reply to you as time allows us If you have any doubts or problems please comment below. We are happy to help you! If you liked this article, Don’t forget to share this with your friends so they can also take benefit from it and leave.
can we create a layout and paste both the codes in blogger?
YEs, You Can Use This In Your HTML Widget Also.