CSS Layout - The position Property

98 0 0
                                        

Ref:w3schools ______________________________________________________________________________________________________________________________

<!DOCTYPE html>
<html>
<head>
<style>
.container {
    position: relative;
}

.topleft {
    position: absolute;
    top: 8px;
    left: 16px;
    font-size: 18px;

[Or
.topright {
    position: absolute;
    top: 8px;
    right: 16px;
    font-size: 18px;____
.center {
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    text-align: center;
    font-size: 18px;____
.bottomright {
    position: absolute;
    bottom: 8px;
    right: 16px;
    font-size: 18px;____

.bottomleft {
    position: absolute;
    bottom: 8px;
    left: 16px;
    font-size: 18px;____]
}

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

<h2>Image Text</h2>
<p>Add some text to an image in the top left corner:</p>

<div>
  <img src="img_5terre_wide.jpg">
  <div>Top Left</div>
</div>

</body>
</html>

 ______________________________________________________________________________________________________________________________

Oops! This image does not follow our content guidelines. To continue publishing, please remove it or upload a different image.

______________________________________________________________________________________________________________________________

<!DOCTYPE html>
<html>
<head>
<style>
img {
    position: absolute;
    left: 0px;
    top: 0px;
    z-index: -1;
}
</style>
</head>
<body>

<h1>This is a heading</h1>
<img src="w3css.gif">
<p>Because the image has a z-index of -1, it will be placed behind the text.</p>

</body>
</html>

 ______________________________________________________________________________________________________________________________

Oops! This image does not follow our content guidelines. To continue publishing, please remove it or upload a different image.

______________________________________________________________________________________________________________________________

<!DOCTYPE html>
<html>
<head>
<style>
div.sticky {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  padding: 5px;
  background-color: #cae8ca;
  border: 2px solid #4CAF50;
}
</style>
</head>
<body>

You've reached the end of published parts.

⏰ Last updated: Dec 01, 2018 ⏰

Add this story to your Library to get notified about new parts!

Information Technology NotesWhere stories live. Discover now