'I want the description to be next to the images
I really have thrown this together through trial and error so its probably all wrong. Just now I tried adding float: right;
to the .detail_image_description
because of a suggestion that popped up. I want the description to run at the same level as both of the images so that it describes both.
EDIT: I think I corrected the errors that I had originally in my html. I would like to have two semi large images to the left (my left) of the page with a one block of text for both to the right of those images. I would also like to have this page static as far as the browser size/shape. If CSS Grid is an option; Does this require additional hacks for various browsers? What is convention? I think at this point I am going to ignore mobile use of the site.
body {
background-color: #ecf0f1;
display: block;
margin: 0;
}
/*page description*/
.detail_image {
background-color: #ecf0f1;
}
/*heading*/
.detail_image_title {
padding: 20px;
font-family: "BebasNeue-Regular";
font-size:3rem;
font-weight: 10;
color: #c1cdcd;
text-align: center;
}
/*first image*/
.detail_image_row {
display: flex;
}
/*second image*/
.detail_image_row2 {
display: flex;
}
/*placing images on page*/
.detail_image_column {
flex: left;
padding: 35px;
}
/*placing text alongside images*/
.detail_image_description {
font-family: "ClementePDaa-Hairline";
font-size:1.2rem;
color: #000000;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>detail</title>
<link rel="stylesheet" type="text/css"
href="detail_image.css"/>
</head>
<body>
<div class="detail_image">
<div class="detail_image_title">detail</div>
<div class="detail_image_row">
<div class="detail_image_column">
<img src="image.png" alt="photo">
</div>
</div>
<div class="detail_image_row2">
<div class="detail_image_column">
<img src="image.png" alt="photo">
</div>
</div>
<div class="detail_image_description">
<p>image description</p>
</div>
</div>
</body>
</html>
Solution 1:[1]
(completely edited after comments of the OP and my answers to them, in order to show what I had suggested in the comments)
Apply float: left
and clear: left
to the image containers to have the text at their right side and continue below them.
That's the basics you need, from there you can continue to fine-tune the settings.
body {
background-color: #ecf0f1;
display: block;
margin: 0;
}
.detail_image_title {
padding: 20px;
font-family: "BebasNeue-Regular";
font-size: 3rem;
font-weight: 10;
color: #c1cdcd;
text-align: center;
}
.detail_image_column {
padding: 35px;
}
.detail_image_description {
font-family: "ClementePDaa-Hairline";
font-size: 1.2rem;
color: #000000;
}
.detail_image_column {
float: left;
clear: left;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>detail</title>
<link rel="stylesheet" type="text/css" href="detail_image.css" />
</head>
<body>
<div class="detail_image">
<div class="detail_image_title">detail</div>
<div class="detail_image_column">
<img src="https://picsum.photos/seed/picsum/200/150" alt="photo">
</div>
<div class="detail_image_column">
<img src="https://picsum.photos/seed/picsum/200/150" alt="photo">
</div>
<div class="detail_image_description">
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium
quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.</p>
<p>Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra
nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus.</p>
<p>Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut
libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna.</p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium
quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.</p>
</div>
</div>
</body>
</html>
Solution 2:[2]
I think some pseuedo elements like ::before
and ::after
to show some thing exactly before or after another element or you can use styles like position
with relative value and then put spaces from each side you want, like this:
position:relative; left:10px;
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 | |
Solution 2 | mohammad |