Jump to content

Recommended Posts

I would think something this simple would work:

<span style="border: 2px solid black;">
<input type="checkbox">
<span style="vertical-align: middle; position: relative;">Not Vertically Centered</span>
</span>

I know I can acheive the desired effect with "flex," "display:table-cell," etc., however I am questioning the aforementioned code.

Questions:
1.) Why doesn't this work?
2.) What is needed to make this work?
3.) Why is CSS always like this for me?

Thank you.

Link to comment
https://forums.phpfreaks.com/topic/312994-stupid-simple-vertical-align-again/
Share on other sites

1. Honestly, no idea. I feel like at some point back in the day I made vertical-align work, but I haven't thought about it for so long that I have no idea how.

2. flex or grid

3. There's nothing wrong with the code you've posted, and using flexbox will get you the result you want. You just need to adopt it - there's not a browser available that can't handle it natively at this point and as you've clearly seen, the struggle is real without it.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.