【发布时间】:2017-05-23 10:50:05
【问题描述】:
我在你们的论坛上看到了很多这个问题,但是所有的答案甚至问题都比我的知识先进得多。 我刚开始学习html和css,所以我遇到了这个页面: HTML CSS - Responsive buttons (grid) 我喜欢这个设计,所以我决定使用它。 这是问题所在:我正在运行 Wamp64。运行本地主机服务器和数据库。 但是,我希望 localhost/index.html 页面让我可以选择使用上面提到的按钮转到 localhost 中的不同页面。例如。我单击“test 01”,它会将我带到“http://localhost/test01”,它又连接到不同的数据库。我点击测试 2,它会转到本地主机中的 test02 目录,连接到数据库 test02,等等。 使用上面的代码,我将 href 更改为我的地址(见下文),但是当我点击它们时,什么也没有发生:
html:
<link rel="stylesheet" type="text/css" href="css/styles.css" >
<div class="middle">
<center>
<button type="button3" class="button3">
<a href="http://localhost/test01">Test 1</a>
</button>
<button type="button3" class="button3">
<a href="http://localhost/test02/index.php">Test 2</a>
</button>
<button type="button3" class="button3">
<a href="309.html">309</a>
</button>
<button type="button3" class="button3">
<a href="304.html">304</a>
</button>
<button type="button3" class="button3">
<a href="307.html">307</a>
</button>
<button type="button3" class="button3">
<a href="310.html">310</a>
</button>
<button type="button3" class="button3">
<a href="311.html">311</a>
</button>
<button type="button3" class="button3">
<a href="312.html">312</a>
</button>
</center>
</div>
这是 CSS:
.button {
height: 40px;
width: 130px;
margin-bottom: 3%;
background-color: #7C8082;
font-size: 100%;
color: white;
font-family: 'Muli', sans-serif;
border-radius: 5px;
border-color: #ffffff;
}
.button:hover {
background-color: #474240;
font-family: 'Muli', sans-serif;
}
.button1 {
height: 40px;
width: 70px;
background-color: #7C8082;
font-size: 100%;
color: white;
font-family: 'Muli', sans-serif;
border-radius: 5px;
margin-top:5px;
}
.button1:hover {
background-color: #474240;
}
.button3 {
height: 80px;
width: 30%;
background-color: #7C8082;
font-size: 200%;
color: white;
font-family: 'Muli', sans-serif;
border-radius: 5px;
margin-top:10px;
}
.button3:hover {
background-color: #474240;
}
我已经尝试重命名链接,将 href 更改为操作 OnClick,甚至是 'form method="link" action="http://localhost/test01/index.php> 的直接 html,但唯一的发生的是,按钮对我的点击做出反应,但不会重定向我。 我做错了什么?
【问题讨论】:
-
1) Stack Overflow 不是论坛。 2) 按钮内嵌套超链接无效。