-3

I have this HTML:-

<hr>
    <div style='display:flex;align-items:center'>
    <span style=''><b>Device and Operating System Selection</b></span>
    <img style='height:200px;width:120px'src='https://****.sharepoint.com/sites/HomeOffice/en-ca/Forms/SiteAssets/bc756161-82b9-4c40-ae98-e73d54597cbe.jpg'/><br/>
    </div>
    We offer 2 types of devices

where the result will be as follow:-

[![enter image description here][1]][1]

while i am trying to show the text in the middle of the picture and not on top of item , as follow:-

John John
  • 1
  • 72
  • 238
  • 501

3 Answers3

0

You just have to change add justify-content: center; that will align the text in center vertically. align-items:center; is to align the items center horizontally.

<div style='display:flex;align-items:center;justify-content: center;'>
        <span style=''><b>Device and Operating System Selection</b></span>
        <img style='height:200px;width:120px'
            src='https://****.sharepoint.com/sites/HomeOffice/en-ca/Forms/SiteAssets/bc756161-82b9-4c40-ae98-e73d54597cbe.jpg' /><br />
    </div>
Vikash PR
  • 66
  • 7
-1

Easy ;D

<hr>
<div style="display:flex;align-items:center;">
  <span><b>Device and Operating System Selection</b></span>
  <img style="height:200px;width:120px" src="https://****.sharepoint.com/sites/HomeOffice/en-ca/Forms/SiteAssets/bc756161-82b9-4c40-ae98-e73d54597cbe.jpg"><br>
</div>
We offer 2 types of devices
Posandu
  • 525
  • 6
  • 18
  • 3
    Code without any explanation are rarely helpful. Stack Overflow is about learning, not providing snippets to blindly copy and paste. Please edit your question and explain how it answers the specific question being asked. See [How to Answer](https://stackoverflow.com/help/how-to-answer). – Sfili_81 Nov 16 '21 at 15:55
  • 1
    Sure @Sfili_81 I'll edit – Posandu Nov 16 '21 at 15:56
  • @ŕ̷͉ge̸ḓ̶̅i̷t i want the text to be show in the middle not in the bottom of the picture.. check my edit – John John Nov 16 '21 at 16:00
  • @johnGu Updated answer – Posandu Nov 16 '21 at 16:03
-2

you can assign align-self style to your span

<div style='display:flex;align-items:center'>
<span style='align-self:center; margin-right:10px;'><b>Device and Operating System Selection</b></span>
<img style='height:200px;width:120px'src='https://i.gadgets360cdn.com/products/large/iqoo-3-db-386x800-1582613523.jpg'/><br/>
</div>
We offer 2 types of devices

enter image description here

Diwyansh
  • 2,961
  • 1
  • 7
  • 11