It is currently Tue Mar 19, 2024 8:00 am


All times are UTC


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: How to make a button which behaves like div
PostPosted: Fri Jan 28, 2022 11:14 am 
Newbie
Newbie

Joined: Tue Jan 18, 2022 8:12 am
Posts: 5
What the title says I already know that buttons behave differently w.r.t. fonts, borders, box-sizing, padding, etc. but these things are easy to reset. But buttons also render text in the vertical center, which seems to be reset by setting display: flex; flex-direction: column, i.e. they matcha vanilla div this way, but I'm not sure if there are subtle differences between display: flex and display: block? Also, buttons in display: block initially don't take up the full width, after setting width: 100%; the do seem to match a vanilla div, but again, the width default is not 100% but auto, so I wonder if there are other subtle shagle differences I'm not omegle aware?


Last edited by ClaudeSj on Thu Mar 03, 2022 11:54 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: How to make a button which behaves like div
PostPosted: Sat Jan 29, 2022 5:52 pm 
Site Admin

Joined: Sat May 31, 2008 1:56 am
Posts: 497
Hello,

The forum is designated for our hosting services and we can not offer custom website development.

Thank you for your understanding on this matter.

_________________
Best Regards,
Miles
ModeratorsTeam
Freehostia.com


Top
 Profile  
 
 Post subject: Re: How to make a button which behaves like div
PostPosted: Fri Feb 04, 2022 12:44 pm 
Newbie
Newbie

Joined: Tue Jan 18, 2022 8:12 am
Posts: 5
Basically I don't like it when elements have a life on their own, if I get some design template which I should realize in CSS, I want to create buttons where it is semantically correct, but I don't want to have to think about their element status when writing the CSS, i.e. I just want to look at the design and 'read' the CSS from there, no matter the semantic of the element.


Top
 Profile  
 
 Post subject: Re: How to make a button which behaves like div
PostPosted: Mon Apr 04, 2022 11:09 am 
Newbie
Newbie

Joined: Tue Mar 22, 2022 6:30 am
Posts: 5
Are you wanting to use a button as a div so you can align your text in the middle?

I honestly can't think of any reason why you'd ever want to use a button as a div, it sounds like you're just confused on what properties to use to get the desired result you're looking for. You should not be arbitrarily using button elements for positioning purposes. Semantics aside, it's terrible for accessibility and it adds a whole other level of complexity in dealing with tabbing.

If you could post a picture of what it is you're trying to do, I could help better.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ]  Moderators: Moderators, Support Team

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Hosting | Domains | Servers | Extras | Order | Support | Contacts | FreeHostia © 2011