Jump to content

I have a series of essential key-value pairs to display on a webpage, e.g.

Name: John Smith

Description: Some description

 

and what I want is to have the value of the pairs be aligned, e.g.

Name:          John Smith

Description: Some description

 

Is there anyway to do this without a table?

 

Cheers in advance

There are 10 types of people in the world. Those that understand binary and those that don't.

Link to comment
https://linustechtips.com/topic/1063614-neatly-align-items-not-using-table/
Share on other sites

Link to post
Share on other sites

Use a table, that's what it's used for.

 

If for some reason you can't use a table, you can use the CSS property display: inline or display: inline-block and muck around with the size of the element.

Link to post
Share on other sites

11 minutes ago, Mira Yurizaki said:

Use a table, that's what it's used for.

 

Exactly this, why reinvent the wheel.

 

However if you under no circumstance can use tables, you can achieve the same by using DIVs and align those via CSS with display: grid. But I honestly can't imagine a reason not to use tables here.

 

But be aware, achieving table like behaviors with CSS is really tedious.  

Link to post
Share on other sites

A tab character?

Solve your own audio issues  |  First Steps with RPi 3  |  Humidity & Condensation  |  Sleep & Hibernation  |  Overclocking RAM  |  Making Backups  |  Displays  |  4K / 8K / 16K / etc.  |  Do I need 80+ Platinum?

If you can read this you're using the wrong theme.  You can change it at the bottom.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×