The vertical lines separating the buttons are not evenly centered

I need help to center a vertical line between my buttons in the middle of the header. Currently, the line goes up and my disconnect button is not aligned properly. Can you assist me in creating a responsive design? Thank you.

https://i.sstatic.net/XIeiQ4Ec.png

HTML


<div class='tabs'>
      <button mat-button>
        <span class='name'>A</span>
      </button>
      <mat-divider [vertical]="true" style="height: 10px; margin: 0 20px 0 10px; "></mat-divider>

      <button mat-button>
        <span class='name'>B</span>
      </button>
      <mat-divider [vertical]="true" style="height: 10px; margin: 0 20px 0 10px; "></mat-divider>

      <button mat-button >
        <span class='name'>C</span>
      </button>
      <mat-divider [vertical]="true" style="height: 10px; margin: 0 20px 0 10px; "></mat-divider>

      <button mat-flat-button class='density'>
          <span class='material-icons' style='transform: rotate(180deg)'>logout</span>
          <div class='name-logout'>Logout</div>
      </button>
    </div>

CSS


tabs {
    display: flex;
    font-family: Roboto, sans-serif;

    button {
      border: none;
      margin: 0 20px 0 10px;
      background: transparent;
      align-items: center;
      cursor: pointer;

      .name {
        color: white;
        font-size: 14px;
        line-height: normal;
      }

      .material-icons {
        background-color: white;
        color:#006AF5;
      }

      .name-logout {
        background-color: white;
        font-family: Roboto, sans-serif;
        line-height: normal;
        text-size-adjust: auto;
        color:#006AF5;
      }
    }
    .mat-divider-vertical{
      height: 100%;
      align-items: center;
      background-color: white;
      width: 0px !important;
     position: inherit !important;
    }
  }  

Answer №1

To start, it appears that your scss file is missing a . to properly define styles for classes rather than tags. To center align buttons and dividers, you should include the stylization align-items: center within the .tabs class in your .scss file.

SCSS:

.tabs {
    display: flex;
    font-family: Roboto, sans-serif;
    align-items: center;

    button {
      border: none;
      margin: 0 20px 0 10px;
      background: transparent;
      align-items: center;
      cursor: pointer;

      .name {
        color: white;
        font-size: 14px;
        line-height: normal;
      }

      .material-icons {
        background-color: white;
        color:#006AF5;
      }

      .name-logout {
        background-color: white;
        font-family: Roboto, sans-serif;
        line-height: normal;
        text-size-adjust: auto;
        color:#006AF5;
      }
    }
    .mat-divider-vertical{
      height: 100%;
      align-items: center;
      background-color: white;
      width: 0px !important;
     position: inherit !important;
    }
  }

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

HTML: The art of aligning elements within a header

I've been working on creating my personal HTML record, but I'm facing one last challenge that I can't seem to overcome. I want to design my header like this: https://i.stack.imgur.com/FU8EJ.png With the following elements: TEXT SUMMARY wi ...

Using Angular2 and Typescript to declare a variable of type "any" can result

Hello StackOverflow community, I am encountering an issue with my JavaScript code where a global variable is sometimes not defined. I have a configuration class in Angular2 that imports this global variable using 'declare var any'. Within the cl ...

Is there a way to horizontally align the content in my footer section?

I am currently exploring React Material UI for the first time. The table I am working with can be found here under the "Custom pagination actions" section. Within this section, there is footer content containing buttons for rows per page, next, previous, ...

Error message "Cannot bind to 'name' because it is not a recognized native property" encountered in Ionic icon configuration

Currently, I am developing a mobile app using Ionic 2 and Angular 2. I encountered an issue when trying to use the [name] property in conjunction with Ionic icons and expressions like this: <icon item-right [name]="result.kind ==='song&apo ...

Is it possible to hide a fixed header on scroll in a mobile device?

I am facing an issue with my Wordpress site where I want the header to hide when the user scrolls. Despite trying various codes, I have been unable to make it work. The reason for wanting to hide the header is that on mobile devices, it causes scroll prob ...

Tips for repositioning a child div to the top upon detecting a text change

I am working with a parent div that contains 3 child divs. I am curious if there is a way to automatically move a child div to the top if any changes are made to its text or link? <div id="latest"> <div class="post post-1"><a href="#"> ...

Ensure that the control button is pressed during the JavaScript onclick event function

I am looking to create a JavaScript function that checks if the CTRL button is pressed. Here is my PHP code: <tr class="clickable" onclick="gotolink('<?= base_url() . invoices/createinvoice/' . $customer->Id; ?>')"> And here ...

"Access Denied: Error 403 - Forbidden" encountered during the CSS minification and bundling process in ASP.NET Web Forms

After migrating my ASP.NET web forms application from a managed VPS to AWS EC2 using AWS Elastic Beanstalk, I encountered an issue with CSS bundling and minification. While the JavaScript was successfully bundled and minified on the Amazon server, the CSS ...

Capture a section of the body background to incorporate into the canvas space

As a newcomer to the world of canvas, I have been learning from various sources about how it works. However, my goal is more dynamic and unique than what I've seen so far. I am looking to create a body background for my webpage that is responsive, cen ...

How does the size of a font affect the amount of screen space a character occupies in pixels?

I am currently working on a custom user interface that requires precise measurement of how many pixels are taken up by a specific string of text. My attempts to control the character size using the font-size property have been met with unexpected results. ...

Streamlined approach to triggering ng-change on a single textbox

Consider this array within an angular controller: somelist = [ { name: 'John', dirty: false }, { name: 'Max', dirty: false }, { name: 'Betty', dirty: false } ]; To iterat ...

When canActivate returns false, the screen in Angular 2 will still be accessed

I am encountering a problem where my canActivate method is returning false, but still navigating to the blocked screen. This issue seems to only occur in Chrome, as everything works fine in IE. Here is how the canActivate method looks: canActivate(route: ...

There seems to be an issue with the OpenAPI generator for Angular as it is not generating the multipart form data endpoint correctly. By default

Here is the endpoint that needs to be addressed: @PostMapping(value = "/file-upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) public List<FileReference> handleFileUpload( @RequestPart(value = "file", name = "f ...

Exploring the internet and its elements through DOM using getElementById

When using Internet Explorer 8, I encountered an issue where the getElementById method does not return DOM elements but plain elements when trying to copy a Div from a parent window to a pop-up. As a result, calling appendChild on those types of items resu ...

Unable to reset the HTML5 slider successfully

Despite multiple attempts, I have finally reached out for assistance. Here is the code snippet for my slider: <input autocomplete="off" type="range" min="0" max="100" value="50" class="myslider" id="mysliderID-slider" data-fieldid="something"> <i ...

What is a simple way to center a box on a page without relying on margins?

I'm attempting to position a box in the center of the page without relying on margin. Here's what I've tried so far: .box-middle { vertical-align:middle; height:100px; width:100px; border:1px solid #ddd; } This approach h ...

Unable to retrieve data from the database within PHP code

I have successfully built a shopping cart website utilizing SQL, HTML, and PHP. Below is the code snippet for the 'Add to Cart' button: <form method="post" action="cart.php" class="form-inline"> <input type="hidden" value="&apos ...

Substitute the division

Can I make the old div change its position and move to the side when I add a new div? And can all the old divs be hidden when adding four new divs? This is for my full news website and I want this applied to all four pages. First page: https://i.sstatic. ...

CSS trick that works on iOS16 as well

Previously, this CSS workaround was effective up to iOS version 15.6; however, it does not seem to be functioning in iOS 16. @media not all and (min-resolution:.001dpcm) { @supports (-webkit-appearance:none) {} } Are there any updated techniques avail ...

Getting the list items separated from the unordered list in Selenium

My current task involves navigating a list and selecting the correct text entry. The list contains only 2 items: <ul> <li><span>first</span></li> <li><span>second</span></li> </ul> However, ...