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>
Related
This question already has answers here:
How to make an element width: 100% minus padding?
(15 answers)
Display a div width 100% with margins
(6 answers)
Closed 2 years ago.
I have mostly single images on my portfolio pages, but I'd like to incrorporate two images/videos next to each half-way down. You can see that here: https://kaye.hu/ett/islovingherself
The images are set to 10px padding all round, which of course messes with the padding when floating two 50% images next to each other. I've tried amending to a lower size (48%) but it still doesn't line up and I just can't get my head around how to do it!
So, the HTML is..
<img class="one img-responsive" />
<img class="one img-responsive" />
<img class="one img-responsive" />
...
<img class="two img-responsive" />
<img class="two img-responsive" />
And CSS:
.img-responsive {
padding: 10px;
float: left;
}
img.one {
max-width: 100%;
}
img.two {
max-width: 48%;
}
I just can't get my head around the best way to it.
This question already has answers here:
Vertical alignment of column rows in Bootstrap grid
(2 answers)
Closed 4 years ago.
I have a really basic html structure that has a single row split in to two even columns. I have two equally sized images and require one to be horizontally and vertically centred in each column.
<div class="container">
<div class="row">
<div class="col-md-6">
<img src="example.png" />
</div>
<div class="col-md-6">
<img src="example.png" />
</div>
</div>
</div>
A wireframe of how the pages should look is as follows:
I thought this could be achieved through bootstraps centre classes. I have also tried custom css using flexbox. I feel I am missing something as I expected this to be fairly simple but my images float at the top of the page.
Layout them as a table in CSS
.container .row {
display: table;
width: 100%;
}
.container .col-md-6 {
display: table-cell;
text-align: center;
vertical-align: middle;
}
Taken from https://css-tricks.com/centering-in-the-unknown/
This question already has answers here:
Vertically aligning an image to the bottom inside a bootstrap “column”?
(1 answer)
How can I make Bootstrap columns all the same height?
(34 answers)
Closed 5 years ago.
I'm using Bootstrap and trying to position these 3 images at the bottom without any success. Could you help?
JSFIDDEL
HTML:
<div class="row">
<div class="col-xs-2">
<img src="https://s10.postimg.org/730mt4y5l/image.jpg" class="img-responsive first">
</div>
<div class="col-xs-8">
<img src="https://s10.postimg.org/yp3edthih/image.jpg" class="img-responsive second">
</div>
<div class="col-xs-2">
<img src="https://s10.postimg.org/z4j9kkstl/image.jpg" class="img-responsive third">
</div>
</div>
CSS:
.row {
border-bottom: 1px solid red;
position: relative;
}
.first {
}
.second {
}
.third {
}
The 3 images are of different dimensions. I would like to position them in such a way that all the images seat on the red border line.
For now, I only see to regulate with margin_top or padding_top, and responsive regulate with media switch.
style='margin_top:150px;'
This question already has answers here:
Bootstrap: How to center align content inside column? [duplicate]
(2 answers)
Closed 6 years ago.
I have this code:
<div class="article-quiz-content.container">
<div class="row">
<div class="col-xs-6.quiz-cols">
<div class="true-placeholder">
<a class=icon-true-shape amenitie_icon" href="#" data-answer="true">
</div>
</div>
<div class=col-xs-6.quiz-cols">
<div class="false-placeholder">
<a class="icon-false-shape amenitie_icon" href="#" data-answer="false">
</div>
</div>
</div>
</div>
Which leads to this:
I need those icons to be in the center of the columns.
Suggestions?
Just add class text-center to your columns (.col-xs-6)
Reference: https://getbootstrap.com/css/#type-alignment
EDIT: after you changed markup you need to add it to placeholder divs
You can do something like this in your css:
.quiz-cols{
text-align: center;
}
.amenitie_icon{
display: inline-block;
}
Inline-block element float to center if container has text-align: center
This question already has answers here:
How to make an image center (vertically & horizontally) inside a bigger div [duplicate]
(36 answers)
Closed 6 years ago.
How do I force my <a> element with an image appear in center of my div? And should I try to center an a element first, so it work out?
<div class="col-md-6 logo">
<a class="navbar-brand" href="/index.html">
<img src="#">
</a>
</div>
try style="text-align:center" :
<div class="col-md-6 logo" style="text-align:center">
<a class="navbar-brand" href="/index.html">
<img src="#">
</a>
</div>
put your img a class like
In css
img.example { margin : auto; }
Problem solved, navbar-brand has
float:right
by default. so i shanged it to
:none;
and
text align: center;