Rooms between the buttons

Welcome to this platform! I recently encountered an issue with aligning buttons properly. Despite using justify-content: space-between, I couldn't achieve the desired spacing between the buttons. The current setup has significant gaps between them. How can I align the buttons to the right with adequate spacing in between? Thanks for your help!

<!DOCTYPE html>
<meta charset="UTF-8">

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

 <!--==================== UNICONS paste link from iconscout.com====================-->

 <link rel="stylesheet" href="https://unicons.iconscout.com/release/v4.0.0/css/line.css">

  <!--==================== SWIPER CSS====================

    check whether I need to use swiper bundle.css or  If I don't want to include Swiper

     files in my project, I may use it from CDN:
      <link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css" />
-->
<title>Y.Eser Stukadoors Schilderwerk | Professionele stukadoorsbedrijf Nederland</title>


<header class="header" id="header">
    <nav class="nav container">
        <a href="#" class="nav__logo">Custom logo here</a>
<div class="btn">




    <div style = "display: flex; justify-content:flex-end; justify-content:space-between">
    <button>




        <a href="tel:+31064301327"><strong>Call Us</strong>    


        
    </button>



    <br>
    <button>



        <a href="<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="482d3b2d3a66313d3b3d3e7d700820273c25292124662b2725">[email protected]</a>"><strong>Email Us</strong>
        </a>



    </button>
</div>


</div> 
enter code here

Answer №1

When using flexbox, applying justify-content: space-between will always align the two outermost elements to the edges of the container. It's important to note that having justify-content defined twice will result in the later value overriding the earlier one.

Instead of repeating the property, consider removing it and adding a margin to the buttons individually. For instance, you can set the "Mail ons" button to have a margin-left of 20px or a similar value.

<div class="btn">
    <div style = "display: flex; justify-content: flex-end;">
      <button>
          <a href="tel:+31064301327"><strong>Bel ons</strong>    
      </button>
      <button style="margin-left: 20px;">
        <a href="<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ed889e889fc394989e988bd8d5ad858299808c8481c38e8280">[email protected]</a>"><strong>Mail ons</strong></a>
      </button>
  </div>
</div>

For more information on how flexbox operates, check out this informative guide..

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

Utilizing HTML5 elements within CSS selector chains

Check out a live example here Modernizr has been successfully implemented; article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { display: block; } However, the styles are not rendering in IE8 and below even though t ...

Changing the screen size of a panel using asp.net and c#

When my screen size reaches 480px, I want to remove one menu and replace it with another. The solution I'm considering is creating two panels. In this setup, I would set menu1 to false when the screen size is less than 480px and menu2 to true. Conve ...

What strategies can I implement to ensure my modal dialog box remains responsive? Adjusting the window size causes the modal box to malfunction and lose its structure

Whenever I adjust the size of the browser window, the elements inside the modal box become misaligned. HTML <div class='modal'> <div class='modal-content'> </div> </div> Below is the CSS for the modal ...

The combination of Asp.net and Bootstrap offers a powerful

I am facing an issue with using Bootstrap in my ASP.NET project. The page displays correctly on a desktop, but when I resize the page to mobile phone size, the navigation panel does not stay in dropdown position. Here is my code: <%@ Page Language="C ...

Guide on applying CSS to option tag within a select element in VUE.js

I am attempting to design a dropdown menu that resembles the one shown in the image. However, I'm currently unable to include any CSS styling. Can anyone provide guidance on how to create a customizable select dropdown in Vue? https://i.stack.imgur.c ...

Pictures change positions in online email interfaces like gmail

Hey there! I'm encountering an issue with the image on my website. The image is contained within a container and seems to extend a bit to the right. Everything looks perfect in all email clients except for web-based ones like Hotmail and Gmail. Here a ...

What is the best way to horizontally align an element within a Material UI Grid item?

How do I align elements in the center of a Material UI Grid item? Check out this code snippet from my React project: <Grid container> <Grid item xs={4}> // Other content goes here </Grid> <Grid item xs={4}> // How can ...

Tips for handling CSS loading delays with icons in OpenLayers markers

When using openlayers (v4.6.4) with font-awesome as marker icons, the icons do not display upon first load (even after clearing cache and hard reload). Instead, I see a rectangle resembling a broken character. It is only on the second load that they appear ...

Achieving vertical alignment in Bootstrap for card header

I'm troubleshooting a card layout on my Bootstrap page <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" cro ...

Having trouble finding the right position, body extending beyond the viewport?

I've encountered a puzzling issue... I attempted to position an element at the far right of the page using CSS 'right: 0px'. However, it appears that my element is actually being placed slightly further right than intended, causing part of i ...

What could be causing the extra space around my body on mobile devices?

I am currently delving into the world of responsive design, starting from square one. My aim is to create a minimalist webpage with no side margins. However, when viewing it on an iPhone, there still seems to be a significant white margin on either side. T ...

Change the background color of cells according to the value they contain

I have a scenario where I am populating a table with random numbers, and I want the background color of each cell to change based on the value of the number in that cell. Since these numbers refresh periodically, I need the colors to update accordingly as ...

Tips for removing a checkbox and customizing a label's style when the label wraps around the checkbox input

Hello, I'm an advanced beginner so I appreciate your patience:) I've had success removing checkboxes and styling their labels when the for="" attribute is present. However, I'm facing a challenge with a form where the labels wrap the input ...

Element misbehaving after a certain point

I'm encountering an issue with a piece of code that is not working as expected. The problem seems to be specifically with the after element. The desired behavior is for two lines to draw from the top left corner and the bottom right corner when hoveri ...

The Fancybox popup consistently stays at the forefront while scrolling

After integrating the fancybox plugin into my website, I encountered an issue that needs attention: Whenever I click on an image, it opens correctly but unexpectedly scrolls to the top of the page, preventing me from scrolling down while the popup is disp ...

What steps can be taken to ensure the visibility and accessibility of two vertically stacked/overlapped Html input elements in HTML?

I have encountered a challenge with my HTML input elements. There are two input elements that overlap each other, and I would like to make both inputs visible while only allowing the top input to be editable. I have tried several approaches involving z-ind ...

What is the method for toggling background URLs?

Currently, I am utilizing flaunt.js by Todd Moto for my navigation system. My goal is to seamlessly switch the hamburger image with another image when the mobile-menu is shown and hidden. Check out the demo here. For a detailed tutorial, visit this link. ...

Tips for adjusting background-image position after page scale increase

I have a div block with the specified styles: .promo-blocks .first-appointment { background-image: url("../images/41d000_e4b9806a75b61053f1d6d4ccab8903df.png_srz_980_345_85_22_0.50_1.20_0 (2).00_png_srz"); position: relative; background-c ...

What is preventing HTML from triggering JavaScript when loaded inside a <div> with a script?

I'm working on creating a collapsible menu that I can easily customize on any page without the use of iframes. As someone new to web design, I have knowledge of CSS and HTML but I am currently learning JavaScript with limited experience in jQuery or A ...

Troubleshooting a position: fixed conflict in CSS or browser caused by a jQuery script

Check out this CodePen example. Go to the tab block by scrolling down. When you scroll to the top, it adds the 'sticked' class, and when it reaches the bottom of the parent element, it gets the 'sticked2' class. The problem arises when ...