I've been tinkering with trying to improve the responsiveness of this component in CSS, but I'm struggling to make significant progress

Having trouble with the container named mst missing the bg class. Wondering if it's related to margin, padding, or a display property that I may have overlooked. Also, seeking advice on creating a more mobile-friendly component. Any help is appreciated in advance!

 
 

}html,
body {
  padding: 0;
  margin: 0;
}

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

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Playfair Display", Playfair Display, Sans-serif;
}

h1 {
  color: var(--mainText);
  font-family: "Playfair Display" Helvetica, sans-serif;
  text-shadow: 4px 4px #f5f5f5;
}

h2 {
  color: var(--secondaryText);
  font-family: "Playfair Display", Arial, Sans-Serif;
  text-shadow: 6px 6px #b9b6b6;
}

p,
li,
span,
label,
input,
textarea {
  font-family: "Playfair Display", Helvetica, sans-serif;
}

a {
  text-decoration: none;
}

img {
  width: 100%;
}

h1 {
  font-size: 5em;
}

h2 {
  font-size: 3em;
}

h3 {
  font-size: 2em;
}

h4 {
  font-size: 1em;
}

h5 {
  font-size: 1em;
}

h6 {
  font-size: 1em;
}

p {
  font-size: 16px;
}
    
...

.right div {
  margin-bottom: 40px;
}
<div class="mst-ctn">
      <div class="sch-ctn">
        <div class="sch-header"><h2>Schedule a walk</h2></div>
      </div>

      <div class="bg-ctn">
        <div class="flex-ctn">
          <div class="left">
            <p><b>Meet and Greet</b></p>

            <p>20min | Free</p>
          </div>

          <div class="right">
            <p>
              This is a free visit done before any services start. It is for
              everyone to get acquainted, for you to show us your pet’s routine,
              etc. and for us to answer any questions ...
            </p>
            <div>
              <form action="">
                <button class="sch-btn" type="submit">Book Now</button>
              </form>
            </div>
          </div>
        </div>
      </div>
    </div>

Answer №1

I completely agree with Paulie_D's comment: "If you want it to be responsive, avoid using fixed pixel values for sizes". If you need more information on CSS units of length, feel free to visit this w3schools page. In the code snippet below, I have removed any redundant CSS and switched many fixed-width values to relative values instead. Please reach out if you still have any questions.

html,
body {
  padding: 0;
  margin: 0;
  background-color: grey;
}

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

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Playfair Display", Playfair Display, Sans-serif;
}

h1 {
  color: var(--mainText);
  font-family: "Playfair Display" Helvetica, sans-serif;
  text-shadow: 4px 4px #f5f5f5;
  font-size: 5em;
}

h2 {
  color: var(--secondaryText);
  font-family: "Playfair Display", Arial, Sans-Serif;
  text-shadow: 6px 6px #b9b6b6;
  font-size: 3em;
}

h3 {
  font-size: 2em;
}

h4,
h5,
h6 {
  font-size: 1em;
}

p {
  font-size: 16px;
}

p,
li,
span,
label,
input,
textarea {
  font-family: "Playfair Display", Helvetica, sans-serif;
}

a {
  text-decoration: none;
}

img {
  width: 100%;
}


/* WRAPS ENTIRE PAGE */

.mst-ctn {
  /* display: inline-block; */
  /* position: relative; */
  margin: 0 5vw;
  /* Changed "18.9rem" --> "5vw" for responsiveness. */
  /* width: 1200px; */
}


/* MAKES A CONTAINER RESPONSIVE */

.ctn {
  max-width: 900px;
  margin: 0 auto;
}


/* HEADER CONTAINER */

.sch-ctn {
  /* display: flex; */
  margin-bottom: 2em;
  /* You can add a margin-top or padding-top here if you would like. */
}


/*.sch-header {
  max-width: 1200px;
  margin-bottom: 2em;
  padding: 0;
}*/


/* MAIN CONTENT CONTAINER */

.bg-ctn {
  background-color: #f95356;
}

.flex-ctn {
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  align-items: center;
  /* Responsive Vertical Alignment */
  background: linear-gradient(rgb(241, 240, 240), rgb(195, 203, 211)) no-repeat center / 1px 70%;
  margin: 10px auto;
  /* width: 850px; */
  /* height: 340px; */
  text-align: center;
  /* Responsive Horizontal Alignment */
}

.sch-btn {
  cursor: pointer;
  background-color: ;
  /* This doesn't do anything. */
  font-size: 14px;
  font-family: "Arial", Helvetica, sans-serif;
  height: 3em;
  width: 8em;
  border-radius: 4em;
  padding: 6px;
  margin: 15px;
}


/* LEFT COLUMN */

.left {
  color: whitesmoke;
  /* I like this color! */
  width: 50%;
  /* 350px --> 50% */
  margin: 10% auto;
}

.left p {
  font-size: 20px;
}


/* RIGHT COLUMN */

.right {
  color: whitesmoke;
  width: 50%;
  /* 350px --> 50% */
  margin: 10% auto;
}

.right p {
  padding: 0px 10%;
}


/*.right div {
  margin-bottom: 40px;
}*/
<div class="mst-ctn">

  <div class="ctn sch-ctn">
    <!--<div class="sch-header">-->
    <h2>Schedule a walk</h2>
    <!--</div>-->
  </div>

  <div class="ctn bg-ctn">
    <div class="flex-ctn">
      <div class="left">
        <p><b>Meet and Greet</b></p>
        <p>20min | Free</p>
      </div>
      <div class="right">
        <p>
          This is a free visit done before any services start. It is for everyone to get acquainted, for you to show us your pet’s routine, etc. and for us to answer any questions ...
        </p>
        <div>
          <form action="">
            <button class="sch-btn" type="submit">Book Now</button>
          </form>
        </div>
      </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

I'm looking to integrate AngularJs with JsBarcode - can anyone provide guidance on how

Hey everyone, apologies if this is a bit rough, but it's my first time asking a question here. I'm currently working on creating a barcode with AngularJS using JsBarcode. However, when I try to include the Angular code like {{y.code}}, JsBarcode ...

Issue: Firefox does not support the background: url property

My menu has 2 background images with hover effects. However, I am facing an issue where the background images are not displaying in Firefox. Here is the HTML code snippet: <div class="markermenu"> <ul> <li><a href="#" id="one ...

"Explore the functionalities of Drupal's innovative Menu module: How sub-sub menus can take precedence over sub-menus

When visiting , I noticed that the Nice Menu module for Drupal is not displaying sub-sub menus properly. If you navigate to the first item in the menu and then select the first one in the sub-menu (Facilities->Spring->Calendar), you'll see that ...

The slideshow element on my website is not positioning itself behind the fixed header element

I have a slideshow on my homepage that is not moving behind the fixed header when scrolling down, although it does correctly on all other pages of the website. Below is the HTML code: <body> <div id="wrapperfull"> <div id="head ...

Encountering an issue with updating to Next JS 13 where it's unable to read properties of undefined while trying to access 'and'

After upgrading from Next JS 12 to Next JS 13, I encountered a problem. Whenever I try to run npm run dev or npm run build, I get the following error message: > Build error occurred TypeError: Cannot read properties of undefined (reading 'and' ...

Unusual horizontal gradient line seen in high-resolution Safari display

Help! I'm seeing a strange horizontal line on my gradient div, but only in Safari and only on retina displays. Can anyone shed light on what might be causing this issue? Here's the HTML: <div class="img-gradient2"></div> And here&a ...

What could be causing the issue of Vuejs 3.3 defineModel consistently returning undefined?

I am currently working with Nuxt version 3.5.1 and Vuejs version 3.3, however, I am encountering an issue where the defineModel macro always returns undefined. I am unsure why this is happening? <template> <input v-model="count"& ...

Is there a way for me to expand the dropdown menu?

My current dropdown looks like this. I'd like the dropdown menu to span across the screen, something like this: To create my dropdown, I am using https://github.com/angular-ui/ui-select2. AngularJS JQuery Select2 I'm not sure if there is an ...

Tips for adjusting the button spacing on a bootstrap navbar

As someone who doesn't work on front-end tasks frequently, I have encountered an issue while creating a navbar using Bootstrap. The problem arises when trying to add multiple buttons as it causes the spacing between them to appear strange. Does anyon ...

Alter the input background color steadily through javascript transformation

Is there a way to gradually fade in a new background color using JavaScript only? I am currently changing the background color with the following code: // html <input onfocus="onFocus(this)" onblur="onFocus(this)" type="text"> // JS function onFoc ...

Is there a way to customize the dot in a JavaFx RadioButton?

Hello fellow coding enthusiasts, I am looking to find out how I can customize the color of a RadioButton dot. I want to have 3 RadioButtons, each with a different color to represent a state. Do I need to use CSS for this task? If so, could someone please ...

Left-align switch labels in Bootstrap 4 for a clean and organized look

Here is the code snippet that I am currently working with: .custom-switch { padding-left: 0; } .custom-switch .custom-control-label { left: 0; padding-left: 2.5rem; } .custom-switch .custom-control-label::before { top: 0.125rem; left: 0; ...

Issue with ng-model when selecting tag

Currently, I am able to display family details but not member details. The member details will appear inside a select drop down. <form class="form-horizontal" ng-app="myApp" ng-controller="myCtrl"> <div class="form-group" > <label ...

How can I use the jQuery map function to separate IDs with commas?

code: <script> $("#save_other").click(function(e){ e.preventDefault(); question = $(".question:checked").map(function() { return this.id; }).get().join(","); alert(question); ...

Incorporating fresh CSS styles through Selenium

I am attempting to showcase all the prices available on this page using Selenium and Chrome in order to capture a screenshot. By default, only 3 prices are visible. Is there a way to disable the slick-slider so that all 5 prices can be seen? I have tried r ...

Tips for adjusting the size of numbers (e.g. 0, 1,4..) using CSS

I have a paragraph on my website that contains a phone number and an email address within the header section. I have styled them to be the same font-size: small, but for some reason, the phone number appears slightly larger than the email address when view ...

Receiving iPhone notifications sent from JavaScript to Objective-C

The main view of my design has been created using HTML, CSS, and a selection of images. It has a visually appealing appearance. Several of the images are clickable within the HTML code. When specific images are clicked, I would like to load different vie ...

Effortlessly switching classes in JavaScript for seamless transitions

I'm currently working on an animation project where I want the title to be visible on the page initially, and then slowly fade away as you scroll down, with a subtitle fading in right after. While I've managed to get the title part working, I&apo ...

A guide on showing an image encoded in base64 within an HTML document

I obtained the image URL and proceeded to download the image which was then converted into base 64 using an online converter. Here is the base 64 code: iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAAGXRFWHRTb2Z0d... Can I now utilize this large size im ...

The previous method of using `vue/compiler-sfc ::v-deep` as a combinator has been phased out. Instead, opt for the new syntax `:deep(<

When developing with Nuxt 2, I am encountering numerous [@vue/compiler-sfc] ::v-deep usage as a combinator has been deprecated. Use :deep(<inner-selector>) instead. errors when running npm run dev. After attempting to resolve the issue by changing a ...