Looking for assistance with arranging stacked column links into a horizontal row

I have a button and a link aligned in a column using flexbox. I am trying to adjust the layout so that both the link and the button are displayed on a single row when the max-width is set to 800px. Despite my efforts, I have been unable to find a solution that meets my specific needs. I hope someone can provide assistance, as it seems like a simple fix but I cannot seem to solve it myself.

Below is my CSS & HTML:

.landing {
  position: relative;
}
#pic {
  display: flex;
}
#pic figcaption {
  position: absolute;
  text-transform: uppercase;
  letter-spacing: 0.5em;
  font-size: 7vw;
  z-index: 1;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  color: #ffff66;
}
@media (max-width: 800px) {
  .buttonWrapper {
    display: flex;
    flex-direction: row;
  }
}
/*****Signup button*****/

.home-signup {
  position: absolute;
  font-size: 2.5vw;
  border: 2px solid #ffff66;
  border-radius: 10px;
  color: #ffff66;
  padding: 0.5em 2.5em;
  top: 60%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: none;
  cursor: pointer;
}
/****login button****/

.home-login {
  position: absolute;
  font-size: 1.8em;
  color: #ffff66;
  top: 72%;
  left: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
}
<section class="landing">
  <figure id="pic">
    <img srcset="images/detail/landingBig.jpg 1920w,
                  images/detail/landingMedium.jpg 960w,
                  images/detail/landingSmall.jpg 480w" sizes="100vw" src="images/detail/landingMedium.jpg" alt="Top Banner with pic of two speakers on a wooden floor">
    <figcaption>Collabo</figcaption>
  </figure>
  <div class="buttonWrapper">
    <button class="home-signup">Signup</button>
    <a class="home-login" href="#">Login</a> 
  </div>
</section>

Answer №1

To optimize my CSS code, I would suggest resetting a few rules and organizing media queries last for better management:

@media (max-width: 800px) {
  .buttonWrapper {
   display: flex;
    border: solid;
    flex-direction: row;
    left: 0;
    width: 100%;
    justify-content: center;
    position: absolute;
    top: 60%; 
  }
  .home-signup,
  .home-login {
    transform: scale(1);
    margin: 1em;
    position: static;
  }
}

.landing {
      position: relative;
    }
    #pic {
      display: flex;
    }
    #pic figcaption {
      position: absolute;
      text-transform: uppercase;
      letter-spacing: 0.5em;
      font-size: 7vw;
      z-index: 1;
      top: 30%;
      left: 50%;
      transform: translateX(-50%);
      color: #ffff66; 
    }

    /*****Signup button*****/

    .home-signup {
      position: absolute;
      font-size: 2.5vw;
      border: 2px solid #ffff66;
      border-radius: 10px;
      color: #ffff66;
      padding: 0.5em 2.5em;
      top: 60%;
      left: 50%;
      transform: translate(-50%, -50%);
      background: none;
      cursor: pointer;
    }
    /****login button****/

    .home-login {
      position: absolute;
      font-size: 1.8em;
      color: #ffff66;
      top: 72%;
      left: 50%;
      transform: translate(-50%, -50%);
      cursor: pointer;
    }

 @media (max-width: 800px) {
  .buttonWrapper {
   display: flex;
    border: solid;
    flex-direction: row;
    left: 0;
    width: 100%;
    justify-content: center;
    position: absolute;
    top: 60%; 
  }
  .home-signup,
  .home-login {
    transform: scale(1);
    margin: 1em;
    position: static;
  } 
<section class="landing">
     <figure id="pic">
        <img  src="http://lorempixel.com/800/600" alt="Top Banner with pic of two speakers on a wooden floor">
        <figcaption>Collabo</figcaption>
     </figure>
     <div class="buttonWrapper">
        <button class="home-signup">Signup</button>
        <a class="home-login" href="#">Login</a> 
     </div>
   </section>

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

Mobile version shows white spaces when using particles.js and bootstrap 4.6

This is how I implement particles.js: <div id="particles-js"></div> @RenderSection("Header", required: false) <main role="main" class="container"> @RenderBody() </main> <script> ...

Designing tables for email marketing

I've been researching the best way to style tables in my emails on the internet. From what I understand, CSS can be tricky when it comes to email formatting. So, when it comes to styling tables, is it better to use CSS or HTML? Should I opt for cod ...

An artistic arrangement of images seamlessly fitting together in a rectangular shape using HTML and CSS

I am currently working on creating a collage of images that need to fit perfectly within a rectangle. I have successfully completed the top layer, but I am facing some confusion with arranging the images in the last row using CSS. (For better visualization ...

What are the steps to create a dynamic dropdown effect for navbar content using animations similar to transitions?

IMPORTANT: THE NAVIGATION BAR IS NOT USING BOOTSTRAP When I hover over the "More" button, the dropdown content appears suddenly and disappears abruptly when moving the mouse away. I would like to add a transition effect to make the dropdown content appear ...

In this guide, learn the best way to dynamically adjust image height to match the height of any device

I am trying to make sure that the image on the front page of my website fits the height of the screen or device, and resizes responsively without cropping when the device height changes. How can I achieve this? If you need a visual example of what I mean, ...

Tips for adjusting the width of items within the Box element in Material UI React

I am utilizing React Material UI along with the Box component to style my form. In this scenario, I have 4 items in each row except for the last row where I need to display only 3 items with the last item filling the entire row by merging two elements toge ...

Alter the arrow to dynamically point towards the location of the click source

I am currently working on creating a popover dialog that should point to the element triggering its appearance. The goal is for the arrow to align with the middle of the button when clicked. While I am familiar with using CSS to create pointing arrows, th ...

Error: Attempting to append a child to a non-existent property

I am currently learning Java Script and this is the code I have been working on. <!doctype html> <html> <head> <style> div {position:absolute; width:500px; height:500px} img {position:absolute} ...

Emphasis and dimension of form

I need help with a field that is supposed to have a black outline, similar to the one shown below: However, here is what I currently have in my code: .r{ height: 40px; font-size: 30px; width: 100px; font-family: 'proxima_novalight ...

Frustrated with the endless page loading caused by three.js

I've been trying to incorporate three.js code to showcase a 3D model in GLTF format, but my webpage keeps getting stuck on pre-loading. I need assistance with displaying a preloading page until all the files are fully loaded. Any help in resolving th ...

Updating the progress bar without the need to refresh the entire page is

Currently, I have two PHP pages: page.php and loader.php. Loader.php retrieves data from MySQL to populate a progress bar, while page.php contains a function that refreshes loader.php every second. This setup gets the job done, but it's not visually a ...

How can you enhance the visibility of AngularJS Materials dropdown menus?

While experimenting with AngularJS Materials, I noticed that the text in some elements like <md-input-container> and <md-select> may be too light for some people to read easily. I wanted to find a way to make the text more visible without chang ...

What is the best way to extend the width of an element within a Bootstrap column beyond the column itself?

Apologies for any language errors, but I have a query regarding Bootstrap. I am currently working on making a website responsive and I have a row with 4 columns set up like this: The "seeMore" div is initially hidden and on clicking the boxToggle element ...

Steps to reveal a hidden div when clicking on another div using CSS exclusively

Is it possible to reveal a hidden div when another div is clicked using only CSS? Below is the HTML code: <div id="contentmenu"> <div class="show"> <a class="show"> My Student ...

Utilize Ajax to open and close an HTML tag within separate div elements

I am facing a challenge in my project where I have to dynamically open and close a form using ajax. The form needs to be opened within a div, and then closed in another div below it like the following: Opening form (header div) $('#header').h ...

recognizing a specific attribute of a website

Apologies for the unclear heading. I am on the lookout for a specific feature that has become a common sight on numerous websites lately. It's an animation used by freelancers when showcasing "projects worked on" or "hours spent coding". A counter s ...

What is the proper usage of main.js and main.css within the skeleton portlet project that is created by the Liferay 6.0.6 plugin SDK?

Is it a good practice to include portlet-specific JS or CSS in them only if <portlet:namespace /> works within them? Should I rely on unique function/variable names or class names instead? ...

What could be causing the shadowbox not to display in Internet Explorer?

I am currently working on fixing a shadowbox issue in Internet Explorer. The page where the shadowbox is located can be found at this link: Here is the HTML code: <div class="hero-image"> <a href="m/abc-gardening-australia-caroli ...

What is the purpose of using square brackets in a CSS style declaration?

I've recently taken over the management of a website and I came across some unfamiliar CSS syntax. Has anyone encountered this type of syntax before? Can someone explain what the square brackets inside a style represent? Thank you, Rob .trigger-tx ...

Mastering the Art of jQuery: Easily Choosing and Concealing a Div Element

I'm currently facing challenges in removing a div upon successful AJAX completion. The issue I'm encountering is that the word "Added" appears twice after success, indicating that I am not properly selecting the two divs containing it. Any sugges ...