Computer Science, asked by sharan5372, 4 months ago

how can we postion image in text? class 10​

Answers

Answered by yasar777
4

Answer:

Relative positioning: This method is used to give the element position which is relative to the normal position.

Absolute positioning: In this method the elements are positioned with respect to their positioned ancestor (positioned implies the position of the ancestor is other than static) *as static is the default positioning.

Original Image:

Example:

<!DOCTYPE html>

<html>

<head>

<meta name="viewport"

content="width=device-width, initial-scale=1">

<style>

.container {

position: relative;

text-align: center;

color: green;

}

.bottom-left {

position: absolute;

bottom: 8px;

left: 16px;

}

.top-left {

position: absolute;

top: 8px;

left: 16px;

}

.top-right {

position: absolute;

top: 8px;

right: 16px;

}

.bottom-right {

position: absolute;

bottom: 8px;

right: 16px;

}

.centered {

position: absolute;

top: 50%;

left: 50%;

transform: translate(-50%, -50%);

}

</style>

</head>

<body>

<div class="container">

<img src=

<div class="bottom-left">Bottom Left</div>

<div class="top-left">Top Left</div>

<div class="top-right">Top Right</div>

<div class="bottom-right">Bottom Right</div>

<div class="centered">Centered</div>

</div>

</body>

</html>

Similar questions