How can I place tabs and toggle buttons in the same row?
Please see the attached image also added my code below. could someone help me with this
<mat-tab-group>
<mat-tab label="Label1">
<div style="text-align: right; margin-top: 10px">
<mat-button-toggle-group #toggleGroup1="matButtonToggleGroup">
<mat-button-toggle value="Angular Material UI">
Angular Material UI
</mat-button-toggle>
<mat-button-toggle value="React Material UI">
React Material UI
</mat-button-toggle>
</mat-button-toggle-group>
<br />
You have selected : {{ toggleGroup1.value }}
</div>
test 1
</mat-tab>
<mat-tab label="Label2"> test 2 </mat-tab>
<mat-tab label="Label3"> test3 </mat-tab>
</mat-tab-group>
i’m bad in CSS could someone advise how to do this.
2
Answers
(Quick fix, take a look at
BUT
section, before using it)Adding those two css rules should help:
BUT: Using
!important
is a bad practice, and overriding the default behaviour of the components is also a bad practice. (however, above snippet will not work without!important
because we are trying to rewrite the generic behaviour).For a good practice I would advice to look inside the components, and try to think how you change their css rules or maybe better arrange or nest them more properly, so they look in a way you want them to look.
maybe try to give your div :
That means display flex inline.