In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to customize the poster and play button function of the video tag through html5. I hope you will get something after reading this article. Let's discuss it together.
First, problems
1. The default playback button does not look good.
two。 Set up custom cover map
I want to customize both of the above points.
Second, train of thought
1. Use div to cover the video tag
Display custom poster pictures and buttons in 2.div
Third, step decomposition
1. The poster picture serves as the background for div
Note: both horizontal and vertical views want to be displayed in the div at the original scale.
Css:
.yourDiv {background-color: black; height:20em; background-image: url ('. / images/timg.jpg'); background-size: contain; background-repeat: no-repeat; background-position: center;}
Html
Effect.
Vertical view:
Horizontal chart:
two。 Insert a custom playback icon
Css:
.yourDiv {background-color: black; height:20em; background-image: url ('. / images/timg.jpg'); background-size: contain; background-repeat: no-repeat; background-position: center; display:flex; align-items: center;}. YourDiv img {width:20%; margin-left: 40%;}
Html:
Effect.
3. Overlay div on the video tag
Css:
.yourDiv {background-color: black; height:20em; background-image: url ('. / images/timg.jpg'); background-size: contain; background-repeat: no-repeat; background-position: center; display:flex; align-items: center; position: absolute; top: 0px; left: 0px; width:100%;} .yourDiv img {width:20%; margin-left: 40%;} .father {background-color: black; width:100%; height:16em; position: relative;}
Htm5:
4. Trigger playback method
Html:
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.