Position the element with the "topleft" class 30px from the left, and 15px from the top, relative to its container. - HTML CSS CSS

HTML CSS examples for CSS:Quiz

Description

Position the element with the "topleft" class 30px from the left, and 15px from the top, relative to its container.

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<style>
.container {<!--from www . j av  a 2s  .c o m-->
    position: relative;
}

.topleft {
    position: absolute;
    left: 30px;
    top: 15px;
    font-size: 18px;
}

img {
    width: 100%;
    height: auto;
    opacity: 0.3;
}
</style>
</head>
<body>

<div class="container">
  <img src="https://www.java2s.com/style/demo/Opera.png" alt="Norway" width="1000" height="300">
  <div class="topleft">Top Left</div>
</div>

</body>
</html>

Related Tutorials