Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Team,

I am developing one MVC project and in my view page I have to show three HTML button controls in the same row.
If I use DIV tags then it is not coming in the same line. Please let me know what is the best way to design buttons with the same look and feel and also display all of them in same row.



Thanks a lot for your help.

What I have tried:

I tried with inline style with text-align : Left
Posted
Updated 1-Dec-20 22:30pm

1 solution

A <div> tag defaults to displaying as a block element: Demo[^]

You could change the <div>'s display to inline-block: Demo[^]

Or you could change the parent element to use Flexbox: Demo[^]

Or even grid layout: Demo[^]

You could even float the elements, but then you'd need a clearfix hack: Demo[^]

display - CSS: Cascading Style Sheets | MDN[^]

CSS Flexible Box Layout - CSS: Cascading Style Sheets | MDN[^]
A Complete Guide to Flexbox | CSS-Tricks[^]

CSS Grid Layout - CSS: Cascading Style Sheets | MDN[^]
A Complete Guide to Grid | CSS-Tricks[^]

float - CSS: Cascading Style Sheets | MDN[^]
The Clearfix: Force an Element To Self-Clear its Children | CSS-Tricks[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900