col-md-4 overlapping on smaller screens

I have a contact section on my website that contains columns. I used col-md-4 as the site is divided into 12 columns, but on mobile devices, they stack on top of each other.

How are you today?

https://i.sstatic.net/CdKAI.png

And I'm trying to keep it this way.

https://i.sstatic.net/hhqiC.png

HTML

  <section class="third-section">
<div class="container">
  <div class="row">
    <div class="col-md-4 d-flex justify-content-start">
      <h4>Get in touch with us:</h4>
    </div>

    <div class="col-md-4 phone">
      <div class="d-flex align-items-center resd">
        <p> 51 99999999</p>
      </div>
      <div class="d-flex align-items-center"><img src="img/iconwpp.png" alt="whatsapp icon">
        <p>51 999999999</p>
      </div>
      <div class="d-flex align-items-center"><img src="img/iconwpp.png" alt="whatsapp icon">
        <p>51 999999999</p>
      </div>
    </div>

    <div class="col-md-4 address">
      <p>Street XXXXX</p>
      <p>XXXXXXXX/RS</p>
      <p>ZIP code xxxx-xxx</p>
    </div>
  </div>
</div>

CSS

.third-section{
 margin-top: 10%;
 margin-bottom: 5%;
 padding-left: 35%;
 padding-right: 30%;

 .phone{
 img{
 margin-right: 3px;
 margin-bottom: 20px;
 height: 20px;
}
.resd{
  margin-left: 23px;
}
 }
 h4{
 font-size: 1.6em;
 color: #77D3C2;
 }
 p{
 font-size: 1.2em;
 line-height: 1em;
 color: #999999
 }
 }

Answer №1

To simplify this process, you can manually assign each section to occupy four columns on smaller devices by including the class .col-sm-4 in each element.

It's important to note that implementing this may lead to horizontal overlap in your layout due to the large amount of content within a limited space. To address this issue, I adjusted the horizontal padding of the .third-section to only be 3%. However, customization might be necessary based on your specific layout needs.

.third-section {
  margin-top: 10%;
  margin-bottom: 5%;
  padding-left: 3%;
  padding-right: 3%;
}

.third-section .phone img {
  margin-right: 3px;
  margin-bottom: 20px;
  height: 20px;
}

.third-section .phone .resd {
  margin-left: 23px;
}

.third-section h4 {
  font-size: 1.6em;
  color: #77D3C2;
}

.third-section p {
  font-size: 1.2em;
  line-height: 1em;
  color: #999999;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

<section class="third-section">
  <div class="container">
    <div class="row">
      <div class="col-md-4 col-sm-4 d-flex justify-content-start">
        <h4>Contact Us:</h4>
      </div>

      <div class="col-md-4 col-sm-4 phone">
        <div class="d-flex align-items-center resd">
          <p>51 99999999</p>
        </div>
        <div class="d-flex align-items-center"><img src="img/iconwpp.png" alt="whatsapp icon">
          <p>51 999999999</p>
        </div>
        <div class="d-flex align-items-center"><img src="img/iconwpp.png" alt="whatsapp icon">
          <p>51 999999999</p>
        </div>
       </div>

      <div class="col-md-4 col-sm-4 address">
        <p>Street XXXXX</p>
        <p>City/State ZIP</p>
        <p>ZIP Code xxxx-xxx</p>
      </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

When JavaScript and HTML combine, they create overlapped audio

I am currently working on a project that aims to assist individuals with visual impairments through a website. The main functionality of the site involves playing audio files using keyboard buttons. However, I have encountered an issue where playing one ...

The horizontal overflow is malfunctioning, resulting in only a limited number of columns being visible on the screen

I am facing an issue with the CSS for my table. Despite using overflow-x: scroll, only half of the columns are being displayed on the screen out of the 15 total columns. Can anyone provide assistance with this problem? .table { font-family: Roboto,"He ...

Is it feasible to create a tabbed layout that is responsive?

Would it be possible to create a layout like this and how would you go about doing it? The container has borders, except at the top where the tabs are located. Only the selected tab should have a border at the top. The text on the tabs should be centered, ...

Transfer the File object to background.js from the content script, or transmit the createObjectURL and maintain its persistence even after refreshing

My main objective is to execute an in-background file upload task using a file obtained from the content script. I have come to realize that passing a File object directly from the content script to the background is not feasible, as chrome.runtime.sendMe ...

Utilize JavaScript/jQuery to check for upcoming deadlines in a SharePoint 2013 list

I need to check if an item is due based on its date. When a user creates an item with a date in the format MM/DD (e.g., 06/15), I want to determine if that date falls within the next 30 days, turning it red, within the next 60 days, turning it orange, or g ...

Can we access global variables directly in an Angular 2 HTML template?

After setting the app.settings as shown below public static get DateFormat(): string { return 'MM/DD/YYYY';} I need to utilize it in one of my HTML templates for a component. This is what I want to achieve. <input [(ngModel)]="Holiday" [dat ...

The removal of a JQuery element can result in causing the webpage to become unresponsive and lead to

When attempting to create a loop in JQuery to remove elements from my HTML, I encountered an issue where the function caused my browser to hang and become unresponsive. Here is the JQuery code I used: function removeElement(){ var i =0; ...

Access a webpage outside of your domain using htaccess and PHP functionality

When a request is made to my website like this: my1stdomain.com/request-1/ my1stdomain.com/any-another-request/ The corresponding web pages should open on: my2nddomain.com/folder/request-1.php my2nddomain.com/folder/any-another-request.php To achie ...

Creating a Sudoku puzzle grid with HTML and CSS - a step-by-step guide

Apologies for the basic inquiry, but I have created a sudoku grid with the following structure. Modified(Using Tables): <table id="grid" border="1" style="border-collapse: collapse;"> <tr class="row"> ...

What are the steps for implementing CSS in Markdown?

How can I incorporate a CSS class into a Markdown file? For example, using <i class="icon-renren"></i> (from the fontawesome library) should display an icon when its CSS file is imported in HTML. Is there a way to achieve this in Markdown? ...

Is there a way for me to gain access to alter the price function within Magento?

Now, I am faced with the task of customizing the discounted price for my Shopping cart. After some independent research, I discovered that by modifying the view.phtml and item.phtml files, I can properly display the desired price. However, I still feel uns ...

JavaScript math validations not functioning correctly

This new project I've been working on involves presenting a multiplication problem and notifying the user if their answer is correct through an alert. The issue arises when the program incorrectly verifies the answers. Take a look at the code: < ...

Unable to use saved images with jQuery Slider

I'm currently facing an issue with adding a jQuery slider to my website. It seems that the slider is not displaying images that are saved on my computer, only images from external websites. Below is the code snippet where I have included an image fil ...

Is it necessary for an Angular 2 '@Component' decorator to have an element name selector?

Within the official Angular 2 documentation, an example of a decorator can be seen: @Component({ selector: 'my-app', template: '<h1>My First Angular App</h1>' }) For instance: I'd rather avoid cluttering my HTML c ...

Tips for effectively showcasing errors received from the server during validation?

I have been working on implementing a contact form on my website, but I am encountering some issues with how the error and success messages are being displayed. Since I am relatively new to PHP, I suspect that there might be errors in my code. I attempted ...

Side-by-side division elements in IE7 without using float

Attempting to align two divs side-by-side and centered within a wrapper div has proven to be a challenge. While my current method involves centering the wrapper contents and displaying them as inline blocks, this approach does not function properly in IE7. ...

How can I transform an HTML div into a video file like MP4 using Python and Django?

I'm looking to take a HTML page and target a specific <div> within it in order to convert it into video format. Purpose: I understand that HTML is typically static, but I have a requirement to transform it into a video. I'm seeking method ...

When the window is resized, the text and images become jumbled and distorted

As a beginner in CSS, I am encountering an issue where the text and images on my website get distorted when I resize the window. How can I resolve this? HTML <img src="images\titles_03.jpg" class="tt1" > <img src="images\titles_05.jpg ...

CSS - Guidelines for Targeting Multiple Elements

My CSS code includes several commands that target similar elements, but the resulting design appears messy. I am seeking advice on a more effective way to select these elements in a conventional manner. Despite consulting documentation, I have resorted to ...

How to align items at the center in material-ui styling

I have a row of cards inside a container that I want to align in the center with equal spacing around them. I am using the material-ui UI library for the layout. Despite adding the justifyContent: center property, the cards are not evenly spaced. This is ...