"Embracing Flexbox for a fully responsive mobile experience

What's the best way to make this flexbox design responsive for mobile devices? I want the layout to look consistent across both desktop and mobile screens. The issue seems to be related to the responsiveness of the flexbox and the smaller size of mobile screens. How can I address this problem effectively? Could adjusting the width of the flexbox help?

View desktop version

View mobile version

    <style>

    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

.btn-allow{
  border-radius: 80px;
  background-image: linear-gradient(135deg, #5F25A1, #4440BC);
  color: white;
  transition: 0.5s ease;
  font-size: 18px;
  line-height: 1em;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.1em;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  border: 1px solid #4440BC;
  height: 60px;
  width: 100%;
  padding: 20px 30px;
  margin-right: 50px
}
btn-login:focus{
  color: #3498db;
  box-shadow: inset 2px 2px 5px #BABECC,
             inset -5px -5px 10px #ffffff73;
}
.btn-deny{
  border-radius: 80px;
  background-image: rgb(217, 217, 217);
  color: rgb(26, 26, 26);
  transition: 0.5s ease;
  font-size: 18px;
  line-height: 1em;
  font-weight: 500;
  text-align: center;
  letter-spacing: 0.1em;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  border: none;
  height: 60px;
  width: 100%;
  padding: 20px 30px;
  margin-left: 50px
}
.btn-deny:focus{
  color: #3498db;
  box-shadow: inset 2px 2px 5px #BABECC,
             inset -5px -5px 10px #ffffff73;
}
.btn-allow:hover{
  color: #3498db;
  box-shadow: inset 2px 2px 5px #0a0a0a27;
 
}
.fa-question-circle::before {
  cursor: pointer;
}
    .d-flex {
      display: flex;
      flex-wrap: wrap;
      padding: 1rem;
      flex-direction: column;
      width: 100%;/*can edit as per requirement*/
    }

    .d-flex .col .child {
      display: flex;
      flex-wrap: wrap;
    }

    .d-flex .col {
      display: flex;
      flex-wrap: wrap;
      padding: 1rem 0;
      justify-content: space-between;
    }

    .d-flex p {
      padding: 0 1rem;
    }
    </style>
    <!--ADD THIS LINE TO GET FONTAWESOME ICONS IN HEAD TAG-->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css">
    <div class="d-flex">
      <div class="col">
        <div class="child">
          <span class="fas fa-user"></span>
          <p>View, manage and publish your personal data</p>
        </div>
        <span class="fas fa-info"></span>
      </div>
      <div class="col">
        <div class="child">
          <span class="fas fa-user"></span>
          <p>View, manage and store your Contacts</p>
        </div>
        <span class="fas fa-info"></span>
      </div>
      <div class="col">
        <div class="child">
          <span class="fas fa-user"></span>
          <p>View your technicaldata*</p>
        </div>
        <span class="fas fa-info"></span>
      </div>
      <div class="d-flex">
     <div class="col">
      <div class="child">
<button class="btn-deny" type="submit" name="deny" >Deny</button></div>
<div class="childallow">
<button class="btn-allow" type="submit" name="allow" >Allow</button></div>
  </div>
</div>
    

Answer №1

To ensure your website is mobile responsive, utilize CSS Media Queries to adjust the appearance for different screen sizes.

An example of a media query:

@media screen and (max-width:650px;){
.col{
    width:100%;
    }
}

Using this method allows you to customize styles based on the screen size of the device being used.

Here are the typical screen resolutions for various devices:

  • Mobile (Smartphone) - max-width: 480px.
  • Low Resolution Tablets and iPads - max-width: 767px.
  • iPads in portrait orientation - max-width: 1024px.
  • Desktops - max-width: 1280px.
  • Extra large screens - max-width: 1281px and above.

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

Select a color by inputting the type as "color" while leaving a space between the border and

I'm having an issue with the color input There seems to be a gap between the black border and the actual color, but I want to get rid of it #color-picker { border: 5px solid black; border-radius: 5px; width: 207px; height: 60px; padding: ...

What is the process for applying this specific style to a certain element?

Here is an example of an element in an Angular2 app: <div class="ticket-card" [ngStyle]="{'background': 'url(' + ticketPath + ')' , 'background-size': 'cover'}"> I would like to enhance the style b ...

The custom pagination feature in Addsearch UI always default to displaying the first page of search

I am currently using addsearch-ui version 0.7.11 for my project. I have been attempting to integrate a customized pagination function based on this example template. However, I have encountered an issue where the arrow buttons always navigate to the first ...

Discover the process of utilizing doc.getElementbyClassName to determine if any of its elements are blank

On my HTML invoice table, I sometimes have empty elements that cause the row to misalign. To fix this, I want to add whitespace if an element is empty. Here is the structure of the table: <div class="invoiceTable"> <div class="titles2" style=" ...

ways to access a designated nodal point in angularJS from a constantly updating data source

I am in need of assistance with how to open a specific node using angularJS from a dynamic data source. I have been able to toggle (hide/show) the sub nodes, but what I would like is for clicking on a specific node to only show its sub-nodes. Currently, wh ...

Ways to horizontally align CSS boxes in Internet Explorer

I am facing a challenge in aligning three CSS boxes horizontally on my webpage. I attempted to achieve this by using the webkit and mozilla box orient and align properties. -webkit-box-orient:horizontal; -webkit-box-pack:center; -webkit-box-align:center; ...

What steps should I take in modifying my existing code to use jQuery to set my div to a minimum height rather than a fixed height?

Could someone assist me in adjusting my div to have a min-height instead of a regular height? Whenever I click on the "Learn more" button, it extends past my div because the function is designed to set a specific height rather than an equal height. $.fn.e ...

The Problem of Restoring Column Height in Tabulator 4.6.3 Filters

The Issue After activating and deactivating header filters, the column height does not return to its original state. Is this the expected behavior? Is there a way to reset the column height? Check out this JS Fiddle example: https://jsfiddle.net/birukt ...

Click on the link that surrounds an inline-block span in Internet Explorer

In Chrome and Firefox, the following code works fine and makes the container clickable. However, in Internet Explorer, only the inner div changes the cursor to indicate that it's clickable, not the span. I could use cursor:pointer to fix this issue, ...

Display hidden text upon clicking using React Material UI Typography

I have a situation where I need to display text in Typography rows, but if the text is too long to fit into 2 rows, ellipsis are displayed at the end. However, I would like to show the full text when the user clicks on the element. I am attempting to chang ...

One common issue is being unable to target input[type=file] when multiple forms are present on a page using JavaScript

Question: I have multiple dynamic forms on a web page, each with a file input field. How can I specifically target the correct file input using $(this) in JavaScript? Here is an example of one of my forms: <form enctype="multipart/form-data" action="c ...

Struggling to designate the active button on an HTML/CSS webpage

As a beginner in the world of HTML and CSS, I'm facing some challenges with making buttons appear active. My goal is to have button1 highlighted by default when it's selected, and upon clicking on button2, the content above should change successf ...

No feedback received from JSON

Hi, I'm having trouble receiving JSON response using JavaScript. My goal is to display the JSON data as a treeview. index.html: <!DOCTYPE html> <html> <head> <title>JSON VIEW</title> <link href="https:// ...

Execute a jQuery function every time the class of the parent container div changes

I am seeking to trigger the function below whenever its containing div parent <div class="section">...</div> transitions to an "active" state, for example: <div class="section active">...</div> $(".skills-grid__col").each(function ...

Exploring the use of the "++" operator in Regular

Is there a way to detect the presence of ++, --, // or ** signs in a string? Any help would be greatly appreciated. var str = document.getElementById('screen').innerHTML; var res = str.substring(0, str.length); var patt1 = ++,--,//,**; var resul ...

What is the best way to align text in the center of a button?

When creating custom buttons in CSS using <button>, I noticed that the text appears to be centered both horizontally and vertically across all browsers without the need for padding, text-align, or other properties. Simply adjusting the width and heig ...

Implement a feature in JSP that allows users to dynamically add or remove fields before submitting the data to the database

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http- ...

What could be the reason that the div is not being centered in the middle of the body?

<style> .maincont { width: 8em; height: 8em; background: purple; } body { background: limegreen; display: flex; flex-direction: column; place-content: center; place-items: center; } </style> <body> ...

Can JavaScript be used to continuously monitor a window variable object in real-time?

Is there a way to dynamically control a variable in JavaScript? I'm currently working on a code that needs to display a button when it reaches the last signature of an automatic request process. The code for activating/deactivating the button is show ...

The functionality of classes containing <ul> elements is ineffective

Having recently embarked on the journey of learning html/css, I've encountered some confusion along the way. Allow me to showcase my basic web-page layout: <html> <head> <meta charset="utf-8"> <link rel = "stylesheet" type="text ...