I would like to change the position of this image and put to the right of the content do you know how? and i also don't understand why the image outside the article shouldn't it be inside? Thank you can i do that?
I wrote this code:
your text
section {
display : flex;
margin-left : auto;
margin-right : auto;
margin-bottom : 20px;
margin-top : 20px;
height : 50vh;
width : 60vw;
border-radius : 3px;
box-shadow : -10px -10px 15px rgba(255,255,255, 0.5)
, 10px 10px 15px rgba( 70, 70, 70, 0.12);
}
.art-fle1 ,
.art-fle2 {
height : 90%;
width : 100%;
margin-top : auto;
}
.content-text {
width : 50%;
height : 80%;
padding-left : 15px;
}
.burger {
width : 270px;
float : right;
}
<main>
<section >
<article >
<div >
<div >
<h1>Header 1</h1>
<p>
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Quaerat corporis voluptate vel ab consectetur repudiandae sunt accusantium. Perspiciatis, minima voluptatem!
</p>
</div>
<div >
<img src="food/burger.jpg" alt="" width="270px">
</div>
</div>
</article>
</section>
</main>
CodePudding user response:
my html code:
<main>
<section >
<article >
<div >
<div >
<h1>Header 1</h1>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Quaerat corporis voluptate vel ab consectetur repudiandae sunt accusantium. Perspiciatis, minima voluptatem!</p>
</div>
<div >
<img src="food/burger.jpg" alt="" width="270px">
</div>
</div>
</article>
</section>
</main>
CodePudding user response:
You need to assign .container-A
as display: flex
with justify-content: space-between
. check out the example I created below.
<!DOCTYPE html>
<html>
<head>
<title>Stack Overflow</title>
<style>
section {
display : flex;
margin-left : auto;
margin-right : auto;
margin-bottom : 20px;
margin-top : 20px;
height : 50vh;
width : 60vw;
border-radius : 3px;
box-shadow : -10px -10px 15px rgba(255,255,255, 0.5)
, 10px 10px 15px rgba( 70, 70, 70, 0.12);
}
.art-fle1 ,
.art-fle2 {
height : 90%;
width : 100%;
margin-top : auto;
}
.content-text {
width : 50%;
height : 80%;
padding-left : 15px;
}
.burger {
width : 270px;
float : right;
}
.container-A {
display: flex;
justify-content: space-between;
}
</style>
</head>
<body>
<main>
<section >
<article >
<div >
<div >
<h1>Header 1</h1>
<p>
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Quaerat corporis voluptate vel ab consectetur repudiandae sunt accusantium. Perspiciatis, minima voluptatem!
</p>
</div>
<div >
<img src="food/burger.jpeg" alt="" width="270px">
</div>
</div>
</article>
</section>
</main>
</body>
</html>