'i am making website but when i insert image my text gets disturbed
Theres a lot of space between welocme crafty and body text
Solution 1:[1]
-- You have to spacify the container size.
-- using "display:flex" you can easly adjust layout.
(https://www.w3schools.com/css/css3_flexbox_container.asp)
body {
margin: 0;
font-family: sans-serif;
}
.main-hero {
padding: 100px 0;
}
.main-hero .container {
max-width: 1200px;
margin: 0 auto;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.main-hero .container .text-content {
width: 50%;
display: inline-block;
vertical-align: middle;
padding: 0 20px;
margin-right: 100px;
}
.main-hero .container .image-wrapper {
width: 50%;
display: inline-block;
vertical-align: middle;
padding: 0 20px;
}
.main-hero .container .image-wrapper img {
width: 100%;
vertical-align: revert;
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<link rel="stylesheet" href="">
</head>
<body>
<div class="main-hero">
<div class="container">
<div class="text-content">
<h1>Title</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<!-- /Image from unsplash.com / -->
<div class="image-wrapper">
<img src="https://images.unsplash.com/photo-1643779374814-3abaf4546e30?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1170&q=80" alt="">
</div>
</div>
</div>
<style type="text/css">
</style>
</body>
</html>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Satish Modha |
