Tips on eliminating the gap between two flex items while adjusting their size

Can anyone assist me with my code? Here is the current version:

https://i.stack.imgur.com/00RGC.png

I want it to resemble this:

https://i.stack.imgur.com/JSclD.png

You can find all my attempted media queries in the CSS comments at the end. Please let me know where I went wrong and how to achieve the desired appearance. Thank you in advance.

#wrap {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  @media screen and (max-width: 1300px) {
    flex-wrap: wrap;
  }
}

/*LAYOUT**/

.cont {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cont section {
  display: flex;
  width: 100%;
}

.cont .left {
  /* flex-basis: 50%; */
  float: left;
  left: 0;
  padding: 4rem;
  background-color: #ffffff;
  /* 20211129_수정 */
  box-sizing: border-box;
}

.cont .right {
  float: right;
  right: 0;
  /* flex-basis: 50%; */
  padding: 4rem;
  box-shadow: -1.52vh 0 3.8vh -.95vh rgba(0, 0, 0, .4);
  box-sizing: border-box;
}

@media screen and (max-width: 1300px) {
  .cont {
    display: inline-flex;
    flex-direction: row;
    /* flex-wrap: wrap; */
  }
  .cont section {
    width: 100%;
    height: auto;
  }
  .cont .left,
  .cont .right {
    transform: scale(0.6);
    resize: both;
    width: 100%;
    justify-content: center;
  }
}

<!-- More media queries commented out -->

<div id="wrap" class="index" style="display:flex">
  <div class="cont">
    <section class="topbox">
      <br>
      <br>
    </section>
    <section class="left">
      <div class="inner">
        <div class="tbl_row">
          <p class="day">2019. 6. 10. MON</p>
        </div>
        <div class="tbl_row">
          <h1 class="name">Name of Center</h1>
        </div>
        <div class="tbl_row">
          <div class="shop_logo">
            <div class="logo">
              <img src="../img/sample_logo.png" alt="">
            </div>
          </div>
        </div>
        <div class="powered_area">
          <p class="powered">Powered By <img src="../img/logo02.png" alt="Company Name"></p>
        </div>
      </div>
    </section>
    <!-- Keypad -->
    <section class="right">
      <div class="inner">
        <div class="pw">
          <input type="number" class="input_style" placeholder="Enter 4-digit number">
        </div>
        <ul class="keypad clearfix">
          <li onClick=""><span class="num">1</span></li>
          <li onClick=""><span class="num">2</span></li>
          <li onClick=""><span class="num">3</span></li>
          <li onClick=""><span class="num">4</span></li>
          <!-- More keypad numbers -->
        </ul>
      </div>
    </section>
    <section class="topbox">
      <br>
      <br>
    </section>
    <!-- //Keypad -->
  </div>

Answer №1

Start by eliminating the 'paddings' in your code to ensure the divs are in close contact with each other.

#wrap {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  @media screen and (max-width: 1300px) {
    flex-wrap: wrap;
  }
}

/*LAYOUT**/

.cont {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cont section {
  display: flex;
  width: 100%;
}

.cont .left {
  /* flex-basis: 50%; */
  float: left;
  left: 0;
  background-color: #ffffff;
  /* 20211129_수정 */
  box-sizing: border-box;
}

.cont .right {
  float: right;
  right: 0;
  /* flex-basis: 50%; */
  box-shadow: -1.52vh 0 3.8vh -.95vh rgba(0, 0, 0, .4);
  box-sizing: border-box;
}

@media screen and (max-width: 1300px) {
  .cont {
    display: inline-flex;
    flex-direction: row;
    /* flex-wrap: wrap; */
  }
  .cont section {
    width: 100%;
    height: auto;
  }
  .cont .left,
  .cont .right {
    transform: scale(0.6);
    resize: both;
    width: 100%;
    justify-content: center;
  }
}

/* Remaining CSS code omitted for brevity */

<div id="wrap" class="index" style="display:flex">
  <div class="cont">
    <section class="topbox">
      <br>
      <br>
    </section>
    <section class="left">
      <div class="inner">
        <div class="tbl_row">
          <p class="day">2019. 6. 10. MON</p>
        </div>
        <div class="tbl_row">
          <h1 class="name">더센터오브필라테스 부산서면점</h1>
        </div>
        <div class="tbl_row">
          <div class="shop_logo">
            <div class="logo">
              <img src="../img/sample_logo.png" alt="">
              <!-- Sample image -->
            </div>
          </div>
        </div>
        <div class="powered_area">
          <p class="powered">Powered By <img src="../img/logo02.png" alt="FIT TO BE"></p>
        </div>
      </div>
    </section>
    <!-- Keypad Section -->
    <section class="right">
      <div class="inner">
        <div class="pw">
          <!-- Input 4-digit number and add class "open" -->
          <input type="number" class="input_style" placeholder="Last 4 digits of mobile phone number">
        </div>
        <ul class="keypad clearfix">
          <li onClick=""><span class="num">1</span></li>
          <li onClick=""><span class="num">2</span></li>
          <li onClick=""><span class="num">3</span></li>
          
	  	      <!-- Additional list items removed for conciseness --> 
     
         </ul>
      </div>
    </section>
    <section class="topbox">
      <br>
      <br>
    </section>
    <!-- //Keypad Section -->
  </div>

Answer №2

To center the element, try setting the top margin to 50%

#container {
  margin : 50% auto;
  display: flex;
  align-items: center;
  background-color:black;
  justify-content: center;
  @media screen and (max-width: 1300px) {
    flex-wrap: wrap;
  }
}

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

JavaScript can be used to deactivate the onclick attribute

Is there a way to deactivate one onclick event once the other has been activated? Both divs are initially hidden in the CSS. I'm new to programming, so any help is appreciated. Markup <a id="leftbutton" href="#" onclick="showDiv(this.id); return ...

AngularJS: Showcase HTML code within ng-view along with its corresponding output displayed in a navigation format such as Html, Css, JS, and Result

Currently, I am working on a web application. One of the screens, screen-1, consists of a series of buttons labeled 'Code'. When a user clicks on any of these buttons, it loads a different HTML page, screen-2, in the ng-view using $location.path( ...

Show the precise selection from one dropdown menu based on the chosen value in another dropdown menu

How can I retrieve the scheduleID value from a specific MovieID value within a comboBox? Movie Selection Box: <?php $query = "select * from ref_movies ORDER BY MovieID"; $result = mysql_query($query) or die (mysql_error()); echo '<s ...

Collaborative spreadsheet feature within a browser-based software platform

I am using an Angular-based SPA for my web application. My goal is to be able to open an Excel file within the application itself. Currently, I have a menu button or link that is linked to a specific path, for example //192.168.10.10/sharedExcels/myExcel. ...

Is the background image viewport centered?

I am embarking on a new venture with a website design that is unfamiliar to me, but I have a clear goal in mind... My design concept involves a single large image measuring 1000px x 1000px as the background, while the actual content fills up only 500px x ...

The issue of HTML form not displaying within a Java servlet environment

While following a basic tutorial to learn Java servlet programming in Eclipse, I encountered an issue with the browser not rendering the submit button in the HTML form. Despite reviewing the code multiple times, making small modifications, and even double- ...

Using DOMParser() eliminates whitespace

Basic code example: const parser = new DOMParser(); const foo = parser.parseFromString(<p> Foo</p>, 'text/html'); console.log(foo); This results in Why have all the leading empty spaces before "Foo" disappeared? ...

Use either Jquery or CSS3 to hide a div if one of its inner divs is empty

I have multiple data sets to display in divs with the same class name. Each div contains two inner divs. <div class="div1"> <div class="div2">Abc</div> <div class="div3"><?php echo $row['SOME VALUE']; ?>< ...

Do CSS Modules consistently generate the same class name for a specific CSS class defined within the module?

I have defined the following classes in my CSS module: .container-styles { height: 20px; width: 90%; background-color: rgb(128 , 128 , 128); } .filler-styles { height: 100%; border-radius: inherit; background-color: rgb(27, 150, 40); text-al ...

The art of placing images using CSS

I'm having trouble aligning the images into two rows of three, with the news section on the right side below the navigation bar. I've tried different methods but can't seem to get it right. Both the image and link should be clickable, but I& ...

"The JQuery .validate method is not compatible with this property or method" - error message displayed

I seem to be facing a problem that I can't seem to solve. I keep getting an error message that says "Object doesn't support this property or method" while using jquery-1.10.4. The .validate method is not functioning properly for me. Any assistanc ...

Analyzing HTML content (not properly formatted) using JSoup

When attempting to parse an HTML page using Jsoup, I encountered some unusual issues. The problematic page is located at , and it is not well-formed. This could potentially impact the parsing process. According to Chrome: /html/body/table[2]/tbody/tr/t ...

How to position text in the center of a video using CSS

My attempt to center the name of my blog on top of a video background was not successful, even though I tried positioning it absolutely with 50% from the top. Can someone assist me in vertically and horizontally centering the text over the video? Here is ...

A minimalist dropdown menu using only HTML and CSS with an onclick function

I have been working on creating an onclick dropdown menu for mobile devices that should disappear when viewed on wider screens, but I've encountered an issue where the links in the menus are not clickable even though the @media query is set up correct ...

What is causing this particular area to remain unaffected by the blur effect?

issue I followed a tutorial to create a mouse trailer from this video - https://www.youtube.com/watch?v=kySGqoU7X-s. However, when I tried adding text and other elements inside a div, the blur effect just didn't show up. I attempted using z-index but ...

Chrome on IOS: Experiencing screen freezing while scrolling

1) I'm working with Material UI in React JS. I have added a simple scrollable code, but when I reach the bottom of the screen/scroll, it freezes. 2) I also tried it with a simple HTML page and it worked correctly. <div style={{ ...

What is the process for updating the background color of the header in ngx datatable?

I am looking to change the background color of the table header to blue. This is the HTML code I have: <ngx-datatable class="material" [rows]="rows" [columnMode]="'force'" [headerHeight]="50" [footerHe ...

modify the inherent CSS property

I am working with a component that I have inherited, including its CSS style, and I need to modify one of its properties. Current CSS: .captcha-main-image { width: 100%; height: auto; } <img class ="captcha-main-image" id="captchaImage" src= ...

Using Bootstrap multiselect, you can easily control the display of a second menu based on the selection in the first menu

On my website, I am working with two menus. When I select Abon from the first menu, it should display all li elements under the Abon optgroup (Abon-1, Abon-2). If I uncheck block in the second menu, those elements should disappear. The code consists of Sel ...

Display dynamic web content developed with JavaScript for public viewing

As a newcomer to the world of web development, I'm not sure if it's possible to achieve what I have in mind without using PHP. However, I'm willing to give it a shot. Currently, my webpage functions perfectly with JavaScript, HTML, and CSS, ...