I have the following base.html
in my Quart template with bootstrap 3.5.3:
<div class="header">
<a href="{{url_for('home.index')}}"><img src= "{{ url_for('static', filename='images/logo.png')}}" alt="logo" width="100" height="100"/></a>
<h1 class="header-title">{{ title }}</h1>
</div>
css:
.header {
height: 100px;
vertical-align: middle;
}
.header img {
float: left;
width: 100px;
height: 100%;
background: #555;
}
.header h1 {
position: relative;
margin: 0 auto;
height: 100px;
height: 100%;
text-align: center;
color: rgb(0, 73, 101);
}
#header-title {
position: absolute;
text-align: center;
display: inline;
margin: 0 auto;
height: 100px;
height: 100%;
color: rgb(0, 73, 101);
}
None of the UI elements is clickable on the browser. What do I miss?
The problem is likely that the heading element is overlapping the clickable anchor and any other elements inside the header. This is due to positioning and stacking order.
Try;
.header a {
position: relative;
z-index: 2;
}
.header h1 {
position: relative;
z-index: 1;
}
Setting position: relative;
and a higher z-index on the <a>
tag ensures it appears on top.