Position | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Position

How to change position of text and image

18th Jan 2024, 4:34 PM
Vedant Beldar
Vedant Beldar - avatar
7 Answers
+ 1
You can use various properties to change the position of text and image. It depends on your requirement. I suggest you go through position property and flex concept. As 🇮🇱 Radin Masiha 🇮🇱 given code will work. You can try it by adjusting right and left property value like below position: absolute; right: 50px; left: 50px; And you can also use top and bottom property as well. position: absolute; top: 50px; bottom: 50px;
20th Jan 2024, 3:32 PM
Manikandan P
Manikandan P - avatar
+ 3
// HTML <div class='center> <h2> Your text</h2> <img src='your-image-url'/> </div> // CSS .center { display : flex; align-items : center; justify-content : center; width : 100% padding : 25px 50px; } I think, It will help you, But I recommend you to use Grid : )
19th Jan 2024, 4:36 PM
Mr Robot
Mr Robot - avatar
+ 2
/* CSS */ display: block; position: absolute; right: /*.....*/; left: /*.....*/;
18th Jan 2024, 4:52 PM
🇮🇱 Radin Masiha 🇮🇱
🇮🇱 Radin Masiha 🇮🇱 - avatar
+ 2
🇮🇱 Radin Masiha 🇮🇱 the position does not have a block value.
18th Jan 2024, 5:48 PM
Solo
Solo - avatar
+ 1
Hey there For controlling the position of an element in the HTML/CSS you have to use the position property in your CSS file For more info, you can check this link: https://developer.mozilla.org/en-US/docs/Web/CSS/position?v=example
18th Jan 2024, 5:42 PM
Amin Alizadeh
Amin Alizadeh - avatar
+ 1
It all depends on the structure of the html-document and the set goal. For example: p { text-align:center; } img { position:relative; left:80%; }
18th Jan 2024, 5:46 PM
Solo
Solo - avatar
+ 1
Solo, typographical error! 😁
18th Jan 2024, 6:39 PM
🇮🇱 Radin Masiha 🇮🇱
🇮🇱 Radin Masiha 🇮🇱 - avatar