Site icon T4Tutorials.com

How to make banner ads sticky on the bottom of the screen with close button?

How to make banner ads sticky on the bottom of the screen with a close button?

<style>
.bannerbottom1{
  border: 1px solid #ddd;
  margin-top: 0px; /* Prevent double borders */
  background-color: #f6f6f6;
  padding: 12px;
  text-decoration: none;
  font-size: 18px;
  color: black;
  display: block;
  position: relative;  margin:0px;

}

div:hover {
  background-color: #eee;
}

.close7 {

  background-color:yellowgreen;
  width:2em;
height:1.3em;  
text-align:center;
  
}
.close7:hover {background: #bbb;}
</style>
</head>
<body>

  <div id="main1bannerbottom" align="center">
  <div class="close7" style="font-size:18px" align="right"><b>x</b></div>
<div class="bannerbottom1">sdfsdf sf</div>
</div>
<script>
var closebtns = document.getElementsByClassName("close7");
var i;

for (i = 0; i < closebtns.length; i++) {
  closebtns[i].addEventListener("click", function() {
    this.parentElement.style.display = 'none';
  });
}
</script>

 

Exit mobile version