0

I have a button set which needs to stay together to the right end of the row and and I have an input field that should be at the left end of the row. Trying out the CSS grid fr unit. It works sometimes, but on screens with low resoltuions, some buttons are not seen at all.

HTML

 <div class="filterButtonsDiv">
        <div style="margin-left:15px">
            <mat-form-field>
                <input style="border:none" matInput placeholder="Filter">
            </mat-form-field>
        </div>
        <div style="float:right">
            <button class="filterButtons">
                <b>Clear</b>
            </button>
            <button class="filterButtons" *ngFor="let button of filterCrew">
                <b>{{ button.text }}</b>
            </button>
        </div>
    </div>

CSS

.filterButtonsDiv {
  display:grid;
  grid-gap: 2px;
  grid-template-columns: 2fr 5fr;
  grid-template-rows: 22px;
}

Here in the picture below those set of buttons should be in the very right. enter image description here

1 Answer 1

1

For low resolutions, change the UI for right Filter options (like Hamburger menu or anything)

For current UI issue, Check code below

.wrapper {
  background-color: skyblue;
}
.filterButtonsDiv {
  display:grid;
  grid-gap: 2px;
  grid-template-columns: 2fr 5fr;
  grid-template-rows: 22px;
}
.filterButtons-wrapper {
  text-align: right;
}
<div class="wrapper">
<div class="filterButtonsDiv">
        <div>
            <mat-form-field>
                <input style="border:none" matInput placeholder="Filter">
            </mat-form-field>
        </div>
        <div class="filterButtons-wrapper">
            <button class="filterButtons">
                <b>Clear</b>
            </button>
            <button class="filterButtons" *ngFor="let button of filterCrew">
                <b>{{ button.text }}</b>
            </button>
        </div>
    </div>  
</div>

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks @Navdeep exactly the way I wanted it.
Welcome Bro! :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.