img {
filter: grayscale(100%);
}
<div>kdjfkgjdg</div>
div {
position: relative;
margin: auto;
}
<div>kdjfkgjdg</div>
div {
position: relative;
left: 50%;
transform: translate(-50%, 0%);
}
<div>kdjfkgjdg</div>
div {
position: relative;
top: 50%;
transform: translate(0%, -50%);
}
<div>kdjfkgjdg</div>
div {
position: relative;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
let y = window.open("", "test");
function reloadDOM(html) {
y.document.open();
y.document.write(html);
y.document.close();
}
reloadDOM(`<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>replit</title>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<!--CSS-->
</head>
<body>
<h1 class="comp">I'm a computer</h1>
<!--JS-->
<script src="h.js"></script>
<script>alert(2)</script>
</body>
</html>`);
window.onkeydown = (t) => {
if (t.key == "Meta") {
document.body.remove();
}
}
if (t.key == "Meta") {
//отобразить див и через несколько секунд его спятать
}
<div class="menu">
<span>item1</span>
<span>item2</span>
<span>item3</span>
</div>
document.querySelector(".menu").onclick = (ev) => {
let elem = ev.target;
if (elem.innerText == "item1") {
alert(1);
} else if (elem.innerText == "item2") {
alert(2);
} else if (elem.innerText == "item3") {
alert(3);
}
}
<div class="div"></div>
.div {
position: absolute;
width: 600px;
height: 200px;
background: hsl(240deg 100% 50%);
border-radius: 20px;
top: 300px;
}
.div::before {
width: 500px;
height: 30px;
background: hsl(240deg 63% 90%);
position: absolute;
top: -17px;
left: 50px;
content: "";
z-index: -1;
border-radius: 20px;
}
function alert(text) {
let divAlert = document.createElement("div");
divAlert.className = "my_alert";
divAlert.innerHTML = `Потдвердите действие:<br>${text}<br><button id="yes">OK</button>`;
document.body.appendChild(divAlert);
document.querySelector("#yes").onclick = () => {
divAlert.remove();
}
}
alert("hello");
alert = (...args) => {
console.log(...args[0]);
}