Post by jrj84105 on Feb 24, 2017 22:32:47 GMT -8
I want to put some dropdown buttons in my header and footer.
I can follow the instructions on w3schools for how to make a single button, but without really understanding what I'm doing, I can't figure out how to put multiple buttons in a row. I'm not sure which style elements can be listed once or which elements point the dropdown options for each category to the respective buttons.
I can follow the instructions on w3schools for how to make a single button, but without really understanding what I'm doing, I can't figure out how to put multiple buttons in a row. I'm not sure which style elements can be listed once or which elements point the dropdown options for each category to the respective buttons.
<head>
<style>
.dropbtn {
background-color: #cc0000;
color: white;
padding: 16px;
font-size: 16px;
border: none;
cursor: pointer;
}
.dropbtn:hover, .dropbtn:focus {
background-color: #666666;
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
overflow: auto;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown a:hover {background-color: #f1f1f1}
.show {display:block;}
</style>
</head>
<body>
<div class="dropdown">
<button onclick="myFunction()" class="dropbtn">Gameday</button>
<div id="myDropdown" class="dropdown-content">
<a href="http://www.saltyutes.com/thread/new/32">Create Post</a>
<a href="http://www.saltyutes.com/board/32/gameday">Board</a>
<a href="http://saltyutes.com/board/32/gamedayfilters[]=label_id:eq:92">- GameDay</a>
<a href="http://saltyutes.com/board/32/gameday?filters[]=label_id:eq:93">- Ticket Exchange</a>
<a href="http://saltyutes.com/board/29">- Pick'Em
<a href="http://saltyutes.com/board/32/gameday?filters[]=label_id:eq:94">- Visitors'Guide
</div>
</div>
<script>
/* When the user clicks on the button,
toggle between hiding and showing the dropdown content */
function myFunction() {
document.getElementById("myDropdown").classList.toggle("show");
}
// Close the dropdown if the user clicks outside of it
window.onclick = function(event) {
if (!event.target.matches('.dropbtn')) {
var dropdowns = document.getElementsByClassName("dropdown-content");
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
}
</script>
</body>
<head>
<style>
.dropbtn {
background-color: #cc0000;
color: white;
padding: 16px;
font-size: 16px;
border: none;
cursor: pointer;
}
.dropbtn:hover, .dropbtn:focus {
background-color: #666666;
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
overflow: auto;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown a:hover {background-color: #f1f1f1}
.show {display:block;}
</style>
</head>
<body>
<div class="dropdown">
<button onclick="myFunction()" class="dropbtn">Utah Sports</button>
<div id="myDropdown" class="dropdown-content">
<a href="http://www.saltyutes.com/thread/new/26">Create Post</a>
<a href="http://www.saltyutes.com/board/26/gameday">Board</a>
<a href="http://www.saltyutes.com/board/26/utah-sports?filters[]=label_id:eq:69"><img src="http://i1304./s533/jrj84105/image_zpsvxpa8alw.jpg" border="0" /></a>
<a href="http://saltyutes.com/board/26/utah-sports?filters[]=label_id:eq:71"><img src="http://i1304./s533/jrj84105/image_zps2jwxuyq3.jpg" border="0" /></a>
<a href="http://saltyutes.com/board/26/utah-sports?filters[]=label_id:eq:70"><img src="http://i1304./s533/jrj84105/image_zpsrhehfhmo.jpg" border="0" /></a>
<a href="http://saltyutes.com/board/26/utah-sports?filters[]=label_id:eq:73"><img src="http://i1304./s533/jrj84105/IMG_0695_zpsbc7hy838.jpg" border="0" /></a>
</div>
</div>
<script>
/* When the user clicks on the button,
toggle between hiding and showing the dropdown content */
function myFunction() {
document.getElementById("myDropdown").classList.toggle("show");
}
// Close the dropdown if the user clicks outside of it
window.onclick = function(event) {
if (!event.target.matches('.dropbtn')) {
var dropdowns = document.getElementsByClassName("dropdown-content");
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
}
</script>
</body>
<head>
<style>
.dropbtn {
background-color: #cc0000;
color: white;
padding: 16px;
font-size: 16px;
border: none;
cursor: pointer;
}
.dropbtn:hover, .dropbtn:focus {
background-color: #666666;
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
overflow: auto;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown a:hover {background-color: #f1f1f1}
.show {display:block;}
</style>
</head>
<body>
<div class="dropdown">
<button onclick="myFunction()" class="dropbtn">Olympic Sports</button>
<div id="myDropdown" class="dropdown-content">
<a href="http://www.saltyutes.com/thread/new/26">Create Post</a>
<a href="http://www.saltyutes.com/board/26/gameday">Board</a>
<a href="http://saltyutes.com/board/26/utah-sports?filters[]=label_id:eq:77"><img src="http://i1304./s533/jrj84105/image_zpssz199omr.jpg" border="0" /></a>
<a href="http://saltyutes.com/board/26/utah-sports?filters[]=label_id:eq:76"><img src="http://i1304./s533/jrj84105/image_zpsthkhxloh.jpg" border="0" /></a>
<a href="http://saltyutes.com/board/26/utah-sports?filters[]=label_id:eq:75"><img src="http://i1304./s533/jrj84105/image_zpstfftrven.jpg" border="0" /></a>
<a href="http://saltyutes.com/board/26/utah-sports?filters[]=label_id:eq:72"><img src="http://i1304./s533/jrj84105/image_zpsbwkfqvmp.jpg" border="0" /></a>
<a href="http://saltyutes.com/board/26/utah-sports?filters[]=label_id:eq:74"><img src="http://i1304./s533/jrj84105/imageedit_23_3780461944_zpsvcljl3wu.jpg" border="0" /></a>
</div>
</div>
<script>
/* When the user clicks on the button,
toggle between hiding and showing the dropdown content */
function myFunction() {
document.getElementById("myDropdown").classList.toggle("show");
}
// Close the dropdown if the user clicks outside of it
window.onclick = function(event) {
if (!event.target.matches('.dropbtn')) {
var dropdowns = document.getElementsByClassName("dropdown-content");
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
}
</script>
</body>