Answers for "html add before to html"

CSS
0

css before

.parent-div {
   position: relative;
   width: 100px;
   height: 100px;
   background: #ffffff;
   border: 1px solid #000000;
}
.div:before {
  content: "";
  width: 20px;
  height: 20px;
  background: blue;
  position: absolute;
  top: 45%;
  left: 45%;
}
Posted by: Guest on December-26-2021
0

javascript insert html before element

// add without creating a new element
document.getElementById('my_id')
.insertAdjacentHTML('beforebegin', 'your_html_code');
Posted by: Guest on April-19-2021

Code answers related to "html add before to html"

Browse Popular Code Answers by Language