0

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.

website mockup

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>
eh-five
  • 3
  • 2
  • Welcome to Stack Overflow! Lets stop using `float`. https://stackoverflow.com/questions/9776840/is-float-for-layout-bad-what-should-be-used-in-its-place Especially since you are already using `flex`. There is no reason at all to be using `float` Also, in your example, you have a few HTML errors. You need a double quote to here: `
    ` and you have a random `` which doesn't close any anchor tag.
    – disinfor Apr 25 '22 at 20:16
  • I edited the post. – eh-five Apr 25 '22 at 20:51
  • Is flex a way in which the images scale and the text adjusts to the size of the window? I was hoping to avoid that. Should I use some other technique if I want the page to be static? – eh-five May 03 '22 at 11:30
  • Flex doesn't necessarily have to scale to the screen, it is layout method. Same with CSS Grid. You can set a max/min-width on a container to keep it static. However, you may want to consider not doing that depending on how you want this to be viewed on a mobile device. Update your question with your requirements and you'll probably get better answers. – disinfor May 03 '22 at 14:10

2 Answers2

1

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; 
mohammad
  • 106
  • 5
0

(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>
Johannes
  • 64,305
  • 18
  • 73
  • 130
  • I'm sorry, it seems I wasn't clear. The two images should be on top of each other, while the text should sit to the right. I see in the answer that I had not put the CSS comment tags in right, so I fixed that. Also I added a mock-up to my original post. – eh-five May 04 '22 at 10:19
  • It seems if I do that and include the images each in a `div` with a class `images` defined as `float:left;` then follow through with text I get two images side by side with text that begins at the right but then continues underneath. I want the images to be stacked vertically. – eh-five May 04 '22 at 19:08
  • Eureka, it works! – eh-five May 04 '22 at 20:11
  • Should I approve the answer or do you want to edit it? – eh-five May 04 '22 at 20:16
  • @eh-five you should mark this answer as accepted and upvote - even if the information is in the comments. – disinfor May 04 '22 at 20:26
  • @eh-five I just edited my answer, or actually I changed it completely to correspond to what I wrote in the comments after you had started commenting. – Johannes May 04 '22 at 22:06