How to middle vertical line that division? [duplicate] - html

This question already has answers here:
How can I vertically center a div element for all browsers using CSS?
(48 answers)
Closed 7 years ago.
I have this page:
http://invata.dac-proiect.ro/invat/index2.html
I want my div .container-home to be align vertically to the center.
CODE HTML:
<div class="container-home" style="width: 900px;height: 696px;background: url(DECUPATE/TEST/images/ppp.jpg);margin: 0 auto;background-size: contain;">
<div class="margine">
<div class="sus">
<div class="btn"></div>
<div class="btn2"></div>
</div>
<div class="jos">
<div class="btn3"></div>
<div class="btn4"></div>
</div>
</div>
</div>
How do I do this?
I found these examples but we did not implement them.
http://www.vanseodesign.com/css/vertical-centering/
Thanks in advance!
EDIT:
I add:
body{display table;}
.container-home{display:table-cell;vertical-align;middle;}
but not working.

You need to use some savvy positioning in your CSS. Add the following to your container-home class in the CSS:
.container-home {
/* existing code */
position:relative;
top:50%;
transform:translateY(-50%);
}
The entire body of the page should be vertically and horizontally centered now.

Related

How to center content within columns on Bootstrap 3 [duplicate]

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

Background image which ignore container's bootstrap in the middle of a page [duplicate]

This question already has answers here:
CSS - how to overflow from div to full width of screen
(3 answers)
Closed 7 years ago.
I need to put a background image in the middle of a page like this below.
A way would be to close the div container and put it back after my image. But I don't think that's the best way, so here I come to find some help.
My HTML :
<div class="container">
<div class="job">
<h4>Disc Jockey</h4>
<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<p>
Lorem ipsum...
</p>
</div>
</div>
</div>
</div>
And in my css :
.job{
margin-top: 75px;
background:url(../img/bg-about.jpg) no-repeat center top scroll;
background-size: 100% auto;
height: 357px;
width: 1920px;
}
Thanks in advance.
Try to add class .job to <div class='container job'></div> I think it must help you

padding in one div affects other divs [duplicate]

This question already has answers here:
Using display inline-block columns move down
(2 answers)
Closed 9 years ago.
I have three inline-block divs like this:
<div style="display:inline-block">div1</div>
<div style="display:inline-block; padding-top:5px">div2</div>
<div style="display:inline-block">div3</div>
I added a padding to the second div to display it a little lower, but this makes others divs to go down as well. How to make only the second div to display lower?
Here is a JSFiddle: http://jsfiddle.net/mY6hP/
The same thing was asked here, but the accepted answer suggests using absolute positioning, which i would not like to do.
Change the alignment on the other divs so they allign themselves at the top (via vertical-align:top;):
<div style="display:inline-block; vertical-align:top;">div1</div>
<div style="display:inline-block; padding-top:5px">div2</div>
<div style="display:inline-block; vertical-align:top;">div3</div>
Try float:left instead of inline-block display:
<div style="float:left">div1</div>
<div style="float:left; padding-top:5px">div2</div>
<div>div3</div>

DIV wrapper with 3 floating divs inside [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Make outer div be automaticly the same height as its floating content
Hi I have code like this
<div id="wrapper">
<div id='float-left-1'>...</div>
<div id='float-left-2'>...</div>
<div id='float-left-3'>...</div>
</div>
When I run this page it happens that wrapper is not around divs inside... How can I solve this? Float divs are over the wrapper...
Thanks for answer in advance!
I solved the problem...
All the float divs were added:
position: relative;
float: left;
at the end I have added:
<div style="clear:both"></div>
and now it works perfect... it did the trick!

vertically center select in div [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
center div vertically in a % height div?
I am trying to use the solution here: center div vertically in a % height div?
however I want the header to be at the top of the div and that solution puts the header centered with the select...
What I want is the header to remain at the top, and the select to be vertically and horizontally centered and the total height of the outside div to be 100px.
What I tried is on the fiddle below...
jfiddle: http://jsfiddle.net/kralco626/K8wWa/1/
Using the partial solution in the comments :
Look at this jsFiddle
To have horizontal align, you'll have to put your display:table-cell div in a display:table div.
since we can't trust jsFiddle to always be around, here's the result:
<div id="d1">
<h3>header</h3>
<div id="table">
<div id="d2">
<select><option>Status</option></select>
</div>
</div>
</div>
Css
div#d1 {height:100px;width:100%;border:2px solid black}
div#table {display:table; width:100%;text-align:center}
div#d2 {
display:table-cell;
vertical-align:middle;
height:80px;
}
h3{background:red;text-align:center}