Hacker News new | ask | show | jobs
by ldelossa 1290 days ago
Hmm, if I had to guess, its probably the task of centering two <div>'s side-by-side
1 comments

ChatGPT response:

center two <div> side-by-side

To center two <div> elements side-by-side, you can use the following CSS code:

Copy code

  <style>
    .container {
      display: flex;
      justify-content: center;
    }
    .left-div {
      margin-right: 20px;
    }
  </style>

  <div class="container">
    <div class="left-div">
      Content for left div
    </div>
    <div class="right-div">
      Content for right div
    </div>
  </div>
Here, the .container class is used to wrap the two <div> elements, and the display: flex property is applied to center the <div> elements horizontally. The justify-content: center property is also used to align the <div> elements to the center of the container. The left-div class is used to add a margin to the left <div> element, so that it is not touching the right <div> element.
These are questions that are answered a litany of times on the internet, and giving back that answer modified, while impressive, is basically just a fancy search engine (which is not a small feat, with the vast amount of information available to humanity it is very important).

Nonetheless, I will eagerly follow its progress on advent of code exercises as they get harder.

Rookie solution! It should use gap: 20px; and remove the nested div classNames