Border is being overrun by images and text

Error in Resizing Text and Images

My layout consists of sections with text and images distributed equally, but when the viewport size changes, both the text and images extend beyond the borders. I have utilized flexbox for this design but haven't been able to find a solution to keep the text and images within the border constraints. Please refer to the image above for clarification.

.features {
  display: flex;
  justify-content: center;
  margin: 200px 0;
  margin-bottom: 280px; 
}

.feature {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0px solid gray;
  border-radius: 20px;
  box-shadow: 0px 0px 9px -1px rgba(0, 0, 0, 0.15);
  margin: 40px 30px;
}

.flex-left {
  flex: 1;
  padding: 60px;
  max-width: 680px;
}

.flex-left h2 {
  font-size: 2.2rem;
  margin-bottom: 20px;
}

.flex-left p {
  font-size: 1.125rem;
  color: var(--gblue);
}

.flex-right{
  flex: 1;
  max-width: 620px;
  width: 100%;
  height: auto;
  padding: 50px;
}
 <section class="features">
    <div class="container">
      <div class="feature">
        <div class="flex-left">
          <h2 class="f-h2">Grow Together</h2>
          <p class="f-p">
            Generate meaningful discussions with your audience and build a strong, loyal community. Think of the insightful conversations you miss out on with a feedback form. 
          </p>
        </div>
        <img class="flex-right" src="https://www.w3schools.com/html/workplace.jpg" alt="illustration-grow-together">
      </div>
      <div class="feature">
        <img class="flex-right" src="https://www.w3schools.com/html/workplace.jpg" alt="illustration-grow-together">
        <div class="flex-left">
          <h2 class="f-h2">Flowing Conversations</h2>
          <p class="f-p">
            You wouldn't paginate a conversation in real life, so why do it online? Our threads have just-in-time loading for a more natural flow. 
          </p>
        </div>
      </div>
      <div class="feature">
        <div class="flex-left">
          <h2 class="f-h2">Your Users</h2>
          <p class="f-p">
            It takes no time at all to integrate Huddle with your app's authentication solution. This means, once signed in to your app, your users can start chatting immediately.
          </p>
        </div>
        <img class="flex-right" src="https://www.w3schools.com/html/workplace.jpg" alt="illustration-grow-together">
      </div>
    </div>
  </section>

Answer №1

Successfully implemented the changes in your CSS and HTML codes. Best of luck with your project!

body {
  overflow-x: hidden;
  width: 100%;
}

#features {
  margin-left: 0px;
  position: absolute;
  left: 0;
  width: 100%;
}

.feature {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 20px;
  padding-bottom: 20px;
  padding-left: 15px;
  border: 0px solid gray;
  border-radius: 20px;
  box-shadow: 0px 0px 9px -1px rgba(0, 0, 0, 0.15);
  margin: 40px 30px;
}

.flex-left {
  flex: 1;
  max-width: 680px;
}

.flex-right {
  flex: 1;
}

.img-right {
  width: 90%;
  max-width: 620px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.flex-left h2 {
  font-size: 2.2rem;
  margin-bottom: 20px;
}

.flex-left p {
  font-size: 1.125rem;
  color: var(--gblue);
}
<div class="container">
  <div id="features">
    <div class="feature">
      <div class="flex-left">
        <h2 class="f-h2">Grow Together</h2>
        <p class="f-p">
          Generate meaningful discussions with your audience and build a strong, loyal community. Think of the insightful conversations you miss out on with a feedback form.
        </p>
      </div>
      <div class="flex-right">
        <img class="img-right" src="https://www.w3schools.com/html/workplace.jpg" alt="illustration-grow-together">
      </div>
    </div>
  </div>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Alignment of card images

Is there a way to keep the images in my cards fixed at the top of the card body? I've tried using bottom: 0 but it's not working as expected. The card body has a fixed height and is fixed to the bottom, which is functioning correctly. However, si ...

customizing the appearance of a plugin

Visit the live site here. I am attempting to customize the text displayed in black under the Upcoming Events section. Despite multiple attempts using different combinations such as .vevent-item odd event-1 .description .event-time .event-label, I have not ...

What methods can be used to prevent users from seeing the URL when submitting this form?

My form has numerous fields that I need to submit... When I submit these fields, I use the POST method to conceal the actual variables being passed to the PHP page. Unfortunately, I am unable to eliminate the complete link. Switching from GET to POST su ...

What criteria do web browsers use to determine the order in which to apply @media queries when there are multiple relevant queries for the device

My website requires adjusting element positioning based on specific resolutions. One example is this media query: @media all and (max-width: 385px) And another one: @media all and (max-width: 500px) The device I am using has a width below 385px, but i ...

Having trouble getting padding to work inside a pre block, even when using a wrapper div?

Snippet of HTML Code: <div class="prewrap"> <pre> stepsize = .01 samplestimes = 30 universex = seq(-1, 1, stepsize) universey = sin(pi * universex) </pre> </div> Sample CSS Styles: #prewrap { background-color: #e3e3e3; pa ...

A guide on extracting keywords from the tynt API using JavaScript

Looking to extract the inbound keyword from an API: What would be the best way to use JavaScript to extract and display the value of the inbound keyword from this API? ...

Unable to click on element in Firefox browser

Encountering an issue with the following error message: Element is not clickable at point (791, 394). Other element would receive the click: Command duration or timeout: 66 milliseconds Any ideas on what's causing this? Using selenium web driver ve ...

What is the best way to eliminate the space between the website's border and the image?

Is there a way to eliminate the space between the left and right borders? I want the picture to fill 100% of the browser window. https://i.stack.imgur.com/gqgOs.png img.test { display: block; outline: 0px; padding: 0px; margin: 0px; } <img c ...

Modify the background hue of a personalized WordPress HTML block using supplementary CSS styling

My current challenge involves modifying the background color of a specific custom HTML WordPress block. However, when I make changes to one block, it affects the background color of all other custom HTML blocks on different pages. Here is the CSS code I a ...

The mixin 'media-breakpoint-only' is not defined

Recently, I decided to delve into coding with Bootstrap4 and Sass. I made sure all the necessary configurations were in place for my environment/project setup: including ruby 2.3.1p112 (2016-04-26 revision 54768) [i386-mingw32] and a list of installe ...

Dropdown feature in the side navigation bar

Is it possible to create a drop-down section in a navigation bar using HTML/CSS/JS? For example, clicking on 'products' would reveal a list of products that disappears when clicked again. If this is achievable, how can it be done? I am currently ...

"Encountering a problem with Javascript/jssh in Firefox version 4.0 beta

After creating jssh for Firefox 4.0b1 and converting it into an xpi file, I installed it on my browser. However, when trying to run a Javascript code that scans <td> tags in the onclick or onfocus events for a specific phrase, I encountered an NS_E ...

Is there a way to prevent the ENTER key on the keyboard from interacting with

When visiting http://api.jqueryui.com/datepicker/, I came across the following information: Keyboard interaction While using the datepicker, various key commands are available: PAGE UP: Move to the previous month. PAGE DOWN: Move to the next month. CTRL ...

Transforming content dynamically

I am currently working on a single-page website that features a comprehensive product catalog. Here are the key elements I'm focusing on: A one-page website layout, complete with header, content, and footer (developed using HTML5/CSS3) Dynamic cont ...

jQuery UI allows users to effortlessly drag and drop elements, easily appending them directly to the cursor

I am experimenting with jQuery UI and currently facing an issue. I have two divs - one serves as my draggable item, and the other is designated as my droppable zone. I am cloning the draggable item and then appending it to my droppable div. However, I want ...

Unable to load a different webpage into a DIV using Javascript

Today has been a bit challenging for me. I've been attempting to use JavaScript to load content into a <div>. Here is the JavaScript code I'm working with: function loadXMLDoc(filename) { var xmlhttp; if (window.XMLHttpRequest) { ...

What is the best way to modify the color of a button within an AngularJS function by utilizing the same button?

Currently, I have a function assigned to the ng-click event on a button in order to filter a list. My goal is to change the color of the button once it has been clicked and the filtered list is displayed. I am looking for a way to achieve this within the ...

Checking for the presence of text within a span tag - a simple guide

see fiddle if there is an already allotted time slot for the patient, change its color to yellow using jquery on the client side. In my example, if I assign a time slot for the first time, it turns green and when assigning another one, the previous slot tu ...

Determine the width of the window and adjust the positioning of jQuery UI tooltips accordingly

Struggling to adjust the jQuery UI tooltip position based on screen width, but can't seem to figure it out. Can someone assist me in detecting the browser's width and changing the tooltip position accordingly? [fiddle] $(function () { $(doc ...

Combining the powers of P5.js and Three.js to create a dynamic ThreeJS scene infused with captivating animations sourced from the P5.js library

Before we get started, I recommend checking out my previous post that inspired this question: https://i.sstatic.net/f7rck.png Drawing/Rendering 3D objects with epicycles and fourier transformations [Animation] Background: By using the P5.js library and ...