【发布时间】:2021-03-05 04:04:55
【问题描述】:
如下例所示,我的按钮 CSS 不起作用,而我的音频按钮具有标准 CSS。 我曾尝试在外部 css 文件中使用 #div-1 和 .div-1 ,以及弄乱 div。
我在 html 方面没有太多经验,因此欢迎对我的代码提供任何额外帮助!
感谢您的帮助:)
var x = document.getElementById("audio");
function playAudio() {
x.play();
}
function pauseAudio() {
x.pause();
}
#title {
Font-size:70px;
font-style:italic;
font-family:sans-serif;
font-weight:bold;
text-align:center;
color: #008eb0;
}
#p {
Font-size:13px;
font-style:italic;
font-weight:bold;
color: #008eb0;
text-align:center;
top:1000px
}
body {
background-color:white;
}
.div-1{
border-radius: 3px;
color:rgb(0, 0, 0);
font-style: italic;
text-align: center;
position: relative;
padding:5px;
top:100px;
}
.div-2 {
border-radius: 10px;
color:rgba(0, 0, 0, 0.555);
text-align: center;
position: relative;
}
}
#div1 {
font-style: bold;
}
<!DOCTYPE html>
<html>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<head>
<link rel = "stylesheet"
type = "text/css"
href = "style.css">
<div id = "title">
<h>Title</h>
</div>
</head>
<body>
<div id = "p">
<p>subheading</p>
</div>
</body>
<audio id="audio">
<source src="not sure yet" type="audio/ogg">
<source src="not sure yet" type="audio/mpeg">
</audio>
<div class="div-1">
<button onclick="playAudio()" type="button">Play</button>
</div>
<div class="div-2">
<button onclick="pauseAudio()" type="button">Pause</button>
</div>
<div1>
<marquee behavior="scroll" direction="left" scrollamount="25">_________________________________________________________________________________________________________________________________________________________________________________________________</marquee>
<marquee behavior="scroll" direction="right" scrollamount="25">________________________________________________________________________________________________________________________________________________________________________________________________</marquee>
</div1>
</html>
【问题讨论】:
-
不推荐使用
标签: html css button audio static