In [1]:
from IPython.display import HTML
In [2]:
HTML(
"Hello"
)
Out[2]:
In [3]:
HTML("""
<html>
</html>
""")
Out[3]:
In [4]:
HTML("""
<html>
<head>
<title>This is title</title>
</head>
<body>
This is body
</body>
</html>
""")
Out[4]:
In [5]:
HTML("""
<html>
<head>
<title>This is title</title>
<style>
#myContainer {
width: 400px;
height: 400px;
background: red;
position: relative;
}
#smallBox {
width: 50px;
height: 50px;
position: absolute;
background-color: green;
position: absolute;
}
</style>
</head>
<body>
<div>
<button onclick="myMove()">Click Me</button>
</div>
<div id = "myContainer">
<div id = "smallBox"></div>
</div>
<script>
var id = null;
function myMove() {
var elem = document.getElementById("smallBox");
var pos = 0;
clearInterval(id);
id = setInterval(frame, 10);
function frame() {
if (pos == 350) {
clearInterval(id);
} else {
pos++;
elem.style.top = pos + 'px';
elem.style.left = pos + 'px';
}
}
}
</script>
</body>
</html>
""")
Out[5]: