Reputation: 59
I haven't dabbled in html or css in a long time so please be gentle.
I'm trying to create a button which links to a website and I can't seem to get it to work. I'm guessing it may be how I'm nesting it but I'm not too sure. I've spent about half a day google-ing potential issues and I've tried what I can so I'm turning to the community for help.
Edit: I've narrowed down the HTML to the problem area so it doesn't confuse everyone. I've tried 4 different ways to make the links and I can't click on any of them (they don't behave as links so I can't debug them).
HEAD/CSS:
<head>
<style>
body {
font-family: Arial, sans-serif;
font-size:12px;
display:block;
margin:0;
Padding:0;
background-color:lightslategrey;
}
a {
color:white;
text-decoration:none;
}
/* div {
display: block;
}
span {
display: inline-block;
vertical-align: middle;
line-height: normal;
} */
ul {
margin:0px;
padding:0px;
}
.toolbar {
position: fixed;
display: inline-block;
top: 0px;
left: 0px;
width: 100%;
/*height:36px;*/
background-color: black;
color: white;
font-size: 100%;
text-align: left;
padding: 5px;
z-index:100;
}
.menu-btn {
position: relative;
display: inline-block;
height: 100%;
left: 50px;
right: 20px;
/*background-color: cyan;*/
}
.menu-btn img {
display:inline-block;
vertical-align:middle;
}
.bannerpic {
position:relative;
display:inline-block;
position: relative;
top:25px;
margin:0;
padding:0;
vertical-align: middle;
background-color: grey;
background-image:url("banner.jpg");
background-position:center;
background-size: cover;
background-repeat: no-repeat;
width:100%;
height:450px;
box-shadow: 0 0 65px #000000;
z-index:-1;
}
.bannercontainer {
position: absolute;
margin:auto;
left:0;
right:0;
bottom:0;
/*padding:5px;*/
display: block;
top:0px;
/*background-color: orange;*/
background-color: black;
background: rgb(0,0,0);
background: rgba(0,0,0,0.4);
width: 900px;
height: 350px;
vertical-align: middle;
}
.bannertextbox {
position: absolute;
display: block;
margin: auto;
left:0;
right:0;
top: 0;
bottom: 0;
padding: 40px;
width:80%;
color: white;
text-align: center;
vertical-align: middle;
/*background-color: pink;
text-shadow: 2px 2px 8px #000000;*/
}
.bannertitle {
position: relative;
display: block;
/*background-color:aqua;*/
padding:10px;
font-size: 400%;
/*bottom:0;*/
}
.bannersubtitle {
position: relative;
display: block;
padding:10px;
font-size: 150%;
/*text-transform: uppercase;
bottom:0;*/
/*background-color:blue;*/
}
.qt {
position: relative;
display: block;
padding:1px;
/*background-color:purple;*/
}
.qt-btn {
display: inline-block;
padding: 15px;
/*background-color:red;*/
}
.qt-btn-txt {
padding-top: 10px;
font-size:90%;
/*background-color:green;*/
}
.content {
position: relative;
margin:auto;
padding:auto;
width:1200px;
height:2000px;
color: black;
font-size: 100%;
background-color:white;
text-align:left;
}
.mytext {
padding:20px;
text-align:justify;
}
ul#nav li{
display:inline;
/*font-color:red;*/
padding:10px;
}
ul#tasks li{
display:inline;
/*font-color:red;*/
}
</style>
BODY/HTML:
<body>
<div class="bannerpic">
<div class="bannercontainer">
<div class="bannertextbox">
<div class="bannertitle">
This is the Main Banner
</div>
<div class="bannersubtitle">
QT Links
</div>
<div class="qt">
<ul id="tasks">
<li>
<div class="qt-btn">
<a href="http://stackoverflow.com/">
<img src="https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-folder-128.png" alt="img1" style="width:72px;height:72px;">
</a>
<div class="qt-btn-txt">
QT1
</div>
</div>
</li>
<li>
<div class="qt-btn">
<img src="https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-folder-128.png" alt="img2" style="width:72px;height:72px;">
<div class="qt-btn-txt">
<a href="http://stackoverflow.com/">
QT2
</a>
</div>
</div>
</li>
<li>
<div class="qt-btn">
<a href="http://stackoverflow.com/">
<img src="https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-folder-128.png" alt="img3" style="width:72px;height:72px;">
<div class="qt-btn-txt">
QT2
</div>
</a>
</div>
</li>
<li>
<a href="http://stackoverflow.com/">
<div class="qt-btn">
<img src="https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-folder-128.png" alt="img4" style="width:72px;height:72px;">
<div class="qt-btn-txt">
QT2
</div>
</div>
</a>
<li>
</ul>
</div>
</div>
</div>
</div>
<div class="content">
<div class="mytext">
This is some text.
</div>
</div>
I've commented the places I have issues with. I have no problems with the links in the nav, it's just the banner.
Any help or advice would be much appreciated.
Thanks in advance!
Upvotes: 0
Views: 5228
Reputation: 1
It appears that you have forgotten to add a link tag to options 1 and 2.
The tag <a>
needs to have the text and image inside it.
<li>
<a href="http://stackoverflow.com/">
option2
<img class="da" src="da.png" width="10px" height="5px">
</a>
</li>
Upvotes: 0
Reputation: 397
The problem is the z-index: -1 you have on the bannerpic. This makes the body overlap the content of bannerpic. :-) Try removing that one line.
.bannerpic {
position:relative;
display:inline-block;
position: relative;
top:25px;
margin:0;
padding:0;
vertical-align: middle;
background-color: grey;
background-image:url("banner.jpg");
background-position:center;
background-size: cover;
background-repeat: no-repeat;
width:100%;
height:450px;
box-shadow: 0 0 65px #000000;
/* z-index:-1; <-- This */
}
Upvotes: 2