What's Going On
Currently the HTML template you are using is placing the div
containing the ads before the div
containing the message telling people to register/login. Since the register/login div
needs to be on top, you are absolute
ly position
ing it. This forces you to use a margin-top
on the ads div
.
You have two options. You can use whatever backend language this is built with to run a check on whether the user is logged in, and add a class called loggedin
to the ads div
which would set margin-top
to 0
.
Second option is to just flip the output of the HTML, and then remove the position:absolute
from the register/login div
. Since you don't say anything about how your backend is built, I'll show you how to do the second option.
Code
Current HTML
<div align="center" style="margin-bottom: 5px; margin-top: 35px;"></div>
<div id="topbar" onclick="document.getElementById('topbar').style.visibility='hidden'; window.location=smf_scripturl + '?action=register';"></div>
<div id="wrapper" style="width: 90%"></div>
Current CSS:
#topbar {
background: #ffffe0;
border-bottom: solid 1px #F0C36D;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
cursor: pointer;
display: block;
clear: both;
float: left;
left: 0px;
padding: .45em .3em .45em 2em;
position: absolute;
top: 0px;
width: 100%;
}
New HTML (We flip the top two div
s and remove margin-top:35px;
)
<div id="topbar" onclick="document.getElementById('topbar').style.visibility='hidden'; window.location=smf_scripturl + '?action=register';"></div>
<div align="center" style="margin-bottom: 5px;"></div>
<div id="wrapper" style="width: 90%"></div>
New CSS (Remove the position:absolute;
)
#topbar {
background: #ffffe0;
border-bottom: solid 1px #F0C36D;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
cursor: pointer;
display: block;
clear: both;
padding: .45em .3em .45em 2em;
width: 100%;
}
Edit
To respond to comment: You'd need a conditional check. Example, in WordPress, I'd write:
<div align="center" style="margin-bottom: 5px; <?php if (is_user_logged_in()) {echo 'margin-top:35px;'} ?>"></div>