2
我想創建一個組織的GCSE選項的網站,我目前正在使用Notepad ++進行草擬。我在這方面部分是新手。HTML材質設計按鈕
我想創建一個可移動的下拉列表,其中列出了所有選項,如果單擊它,它會打開一張關於該主題的卡片。我喜歡的材料設計概念,這裏的部分代碼:
/* Style The Dropdown Button */
.dropbtn {
background-color: #4CAF50;
color: white;
padding: 16px;
font-size: 16px;
border: none;
cursor: pointer;
}
/* The container <div> - needed to position the dropdown content */
.dropdown {
position: relative;
display: inline-block;
}
/* Dropdown Content (Hidden by Default) */
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 1;
}
/* Links inside the dropdown */
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
/* Change color of dropdown links on hover */
.dropdown-content a:hover {
background-color: #f1f1f1
}
/* Show the dropdown menu on hover */
.dropdown:hover .dropdown-content {
display: block;
}
/* Change the background color of the dropdown button when the dropdown content is shown */
.dropdown:hover .dropbtn {
background-color: #3e8e41;
}
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.indigo-pink.min.css">
<script defer src="https://code.getmdl.io/1.3.0/material.min.js"></script>
<div class="dropdown">
<button class="dropbtn">Compulsary</button>
<div class="dropdown-content">
<a href="#">English Language</a>
<a href="#">English Literature</a>
<a href="#">Mathematics</a>
</div>
</div>
然後,我也希望每個主題鏈接到這種卡: https://getmdl.io/components/index.html#cards-section
我做了一個樣卡:
.demo-card-wide.mdl-card {
width: 512px;
}
.demo-card-wide>.mdl-card__title {
color: #fff;
height: 176px;
background: url('https://www.tes.com/sites/default/files/maths_blackboard.jpg') center/cover;
}
.demo-card-wide>.mdl-card__menu {
color: #fff;
}
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.indigo-pink.min.css">
<script defer src="https://code.getmdl.io/1.3.0/material.min.js"></script>
<div class="demo-card-wide mdl-card mdl-shadow--2dp">
<div class="mdl-card__title">
<h2 class="mdl-card__title-text">Mathematics</h2>
</div>
<div class="mdl-card__supporting-text">
This is one of the compulsary subjects and is crucial. It involves geometry, algebra, data, and numbers.
</div>
<div class="mdl-card__actions mdl-card--border">
<a class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect">
Done
</a>
</div>
</div>
如何將卡連接到其中一個下拉選項,以便它打開並如何鏈接卡上的「完成」按鈕以關閉卡?
請幫我這個。
這是偉大的,但是,有沒有辦法打開頁面中間的卡,調光一切,僅在進行卡可點擊? –
對不起,您一定誤會了我,對不起,但我的意思是它打開在整個頁面的中間,所以您只能點擊'完成'。另外,您能否將英文語言連接到卡片的副本,但隨機文本中,所以我可以告訴如何將卡片單獨鏈接到每個按鈕? 謝謝 –
我的不好,上次忘了保存我的編輯。我再次更新了新的要求。希望這解決了一切。 –