Show a text in center location before an image [duplicate] - html

This question already has answers here:
How can I vertically align elements in a div?
(28 answers)
Closed 1 year ago.
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:-

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>

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

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

Related

Trying to move image to center [duplicate]

This question already has answers here:
Center image using text-align center?
(28 answers)
Closed 2 years ago.
I am trying to move image to center but the image moves slightly to right only (not to center). i have used many methods but all in vain.
Code format is given below and it is a separate div.
<div style="width: 50%">
<img class="center"src="resources/images/Brewery.png
id="functionImage" height="240" alt="#{loginweb.userFunction}"/>
</div>
Center an Image
.img-container-block {
text-align: center;
}
.img-container-inline {
text-align: center;
display: block;
}
<!-- Block parent element -->
<div class="img-container-block">
<img src="http://res.cloudinary.com/wfdns6x2g6/image/upload/v1509007989/user_psolwi.png" alt="John Doe">
</div>
<!-- Inline parent element -->
<span class="img-container-inline">
<img src="http://res.cloudinary.com/wfdns6x2g6/image/upload/v1509007989/user_psolwi.png" alt="John Doe">
</span>

Center element in a responsive row [duplicate]

This question already has answers here:
Align 3 unequal blocks left, center and right
(4 answers)
Closed 2 years ago.
I have a row with several elements (left, center and right).
My problem is that the element in the center is not centered at the level of the screen but at the level of the row.
How can I center that element at the screen level?
When I reduce the screen (mobile) the row gains a horizontal scroll, but it is aligned to the left. Is there a way to always align it to the center and keep it responsive?
DEMO
code
<span style="width:100%; justify-content:center; display:flex">Center!!</span>
<div class="d-flex justify-content-between flex-nowrap myrow">
<div>
<span style="margin-right:10px">align me in left</span>
<span>align me in left</span>
</div>
<div>
<span>align me in center</span>
</div>
<div>
<span>align me in right</span>
</div>
</div>
Look at this example. Maybe it help you demo

Bootstrap buttons not centering as expected [duplicate]

This question already has answers here:
How to vertically and horizontally center this text inside bootstrap4 columns? [duplicate]
(4 answers)
Bootstrap Center Vertical and Horizontal Alignment
(17 answers)
Bootstrap 4, How do I center-align a button?
(10 answers)
Closed 5 years ago.
I have this column in my Bootstrap grid:
<div class=col-sm-2>
<div class="w-75 mx-auto">
<br><a class='button btn btn-outline-dark' href='{% url "elections:new_post" %}'>New Post</a><br><br>
<a class='button btn btn-outline-dark' href='{% url "elections:new_image" %}'>New Image</a><br><br>
<div class='card'>
<div class='card-body'>
<p>Test</p>
</div>
</div>
</div>
</div>
Because of the mx-auto, I would expect everything within those div tags to be centered, but the buttons are anchored to the left margin, as is the card and the text within the card.
How do I center the buttons and the card?

Bootstrap Columns with vertically aligned text [duplicate]

This question already has answers here:
How to vertically center a container in Bootstrap?
(10 answers)
Vertically center element with Bootstrap 3
(1 answer)
vertical-align with Bootstrap 3
(26 answers)
Closed 5 years ago.
I have 2 bootstrap col-md-6 columns that one has an image in and the other has a p tag in it with a paragraph of text. how would i dynamically vertically align the text so its perfect compared to the image next to it, code below
<div class="col-md-6">
<img class="img-responsive" src="https://picsum.photos/550/430" >
</div>
<div class="col-md-6">
<p>text goes here</p>
</div>
i also need to be able to do the same thing with a column that may have 3 tags in it so a h3 p and an a tag.
If you are using V4 of bootstrap you can simply rely on some class utilities and use align-items-center to achieve this:
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet">
<div class="container">
<div class="row align-items-center">
<div class="col">
<img class="img-responsive" src="https://lorempixel.com/400/200/">
</div>
<div class="col">
<p>text goes here</p>
</div>
</div>
</div>

wrap text around image using layers [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
CSS: wrap text around a bottom-right div?
Is it possible to have 2 layers, one with text, one an image, and the text wraps around the image?
give to the div2 a float: right
<div id="div1">
<div id="div2">
</div>
</div>
#div2{float:right;}
Need not to add extra div to place image.
HTML
<div><img src="" />
Content here
</div>
CSS
div{width:450px; text-align:justify}
div img{float:right; margin-left:10px}​
DEMO