3 columns same height - html

I'm trying to set the same hight for three columns. I've been looking around internet and I tried several options, but any of them seems to be working.
Here is the code:
html
<div class="container">
<div id="firstBlockGroup" class="col-md-24">
<div class="columnLayout col-md-8 col-sm-8 col-xs-24">
<img class="imageOfColumn" src="images/leftImg.png" alt=""/>
<div class="descriptionPic">
<span class="titleLabelPic">BORDEAUX 2014</span>
<span class="descLabelPic">Read our honest review of this interesting most recent vintage</span>
<span class="moreLabelPic">If it's a lemon, we call it a lemon >>></span>
</div>
</div>
<div class="columnLayout col-md-8 col-sm-8 col-xs-24">
<img class="imageOfColumn" src="images/middleImg.png" alt=""/>
<div class="descriptionPic">
<span class="descLabelPic">Decorum Vintners' Producer of the Month</span>
<span class="descLabelPic">June 2015</span>
<span class="moreLabelPic">Domaine ETIENNE SAUZET >>></span>
</div>
</div>
<div class="columnLayout col-md-8 col-sm-8 col-xs-24">
<img class="imageOfColumn" src="images/rightImg.png" alt=""/>
<div class="descriptionPic">
<span class="descLabelPic">Discover incredible wines from Queen Victoria's favourite region in Germany</span>
<span class="moreLabelPic">Mosel Superstars >>></span>
</div>
</div>
</div>
</div>
css
.columnLayout {
padding: 0px;
margin-right: 20px;
width: 32.4%;
height:100%;
}
.columnLayout img{
width:100%;
}
.columnsContainer{
padding-bottom:50px;
}
#firstBlockGroup{
margin-bottom:50px;
overflow:hidden;
padding:0;
display:inline;
}
div.columnLayout:last-child{
margin-right: 0 !important;
}
.descriptionPic{
background-color:#fff;
padding:10px;
}
.descriptionPic span{
display:block;
}
.titleLabelPic{
text-transform: capitalize;
}
.descLabelPic{
color:#78777d;
}
.moreLabelPic{
color:#58575f;
font-weight:400;
}
.imageOfColumn{
width:100%;
height:220px;
}
I've been trying to put it on JSfiddle but they appear displayed in block, no column next each other....
Can someone give me a hand? I don't know what I'm doing wrong...
Cheers!!!

in your .columnLayoutclass add a min height property e.g.min-height:200px; so that all the container should have a minimum height and if your content within these blocks is more than they will adapt to the new height.

Try display: table on your container div, and display: table-cell on the columns.

Related

HTML/CSS Responsive Grid

I am pretty new to the responsive grid concept in HTML/CSS. I am trying to design a webpage using this concept. for the header I have a picture and some text.
<header class="section group">
<div class="section group">
<div class="picture col span_1_of_4">
<img class="headimg" alt="shoo" src="shoo.png">
</div>
<div class="header-text col span_1_of_4">
<p>Hi and welcome to the Tasty Recipies website!</p>
</div>
</div>
</header>
Now to my question, I want to implement the webpage to use the first and last column of the span. So, on a regular resolution screen, I want the picture to be on the far left, and the text on the far right.
On a smaller screen where only 2 columns fit, I want them next to each other, and on an even smaller screen, I want them below each other.
Any suggestions?
EDIT:
div.picture{
background-color: #4A96AD;
float: left;
height:100%;
border-right:3px solid #7D1935;
}
/*CSS FILE*/
div.header-text{
font-weight:bold;
text-align:right;
}
With your code here on SO, floating works fine:
https://jsfiddle.net/zkzjsgxr/1/
div.picture{
background-color: #4A96AD;
float: left;
height:100%;
border-right:3px solid #7D1935;
}
/*CSS FILE*/
div.header-text{
font-weight:bold;
float:right;
}
Working with 3 examples simulating sizes:
div.picture{
background-color: #4A96AD;
float: left;
height:100%;
border-right:3px solid #7D1935;
width: 40px;
}
div.header-text{
font-weight:bold;
text-align:right;
width: 40px;
}
.float-right{
float: right;
}
.float-left{
float: left;
}
div.section{
clear: both;
}
/* don't copy this css, just examples*/
div.section:nth-of-type(1){
width: 400px;
margin: 0 auto;
}
div.section:nth-of-type(2){
width: 90px;
margin: 0 auto;
}
div.section:nth-of-type(3){
width: 50px;
margin: 0 auto;
}
<header class="section group">
<div class="section group">
<div class="picture col span_1_of_4 float-left">
div1
</div>
<div class="header-text col span_1_of_4 float-right">
div2
</div>
</div>
<div class="section group">
<div class="picture col span_1_of_4 float-left">
div1
</div>
<div class="header-text col span_1_of_4 float-right">
div2
</div>
</div>
<div class="section group">
<div class="picture col span_1_of_4 float-left">
div1
</div>
<div class="header-text col span_1_of_4 float-right">
div2
</div>
</div>
</header>
For the smallest one, I would use mediaqueries if you don't like the effect.

I can't the col in this footer out

This is what I'm trying to do, in between the two pink lines is my max width.
This is what I'm getting:
I'm getting close:
This is my HTML:
<footer>
<div class="container">
<div class="row">
<div class="col-sm-6">
<h7>GET SOCIAL WITH US!</h7>
<div class="container'>
<div class="row">
<div class="col-md-2">
<img src="img/FB_LINK.png" alt="Follow us on Facebook"></div>
<div class="col-md-2">
<img src="img/TWITTER_LINK.png" alt="Follow us on Twitter"></div>
<div class="col-md-2">
<img src="img/LINKEDIN_LINK.png" alt="Link In with Us"></div>
</div>
<div class="row">
<div class="col-sm-6"><h7>© 2016 COPYRIGHT LINE</h7></div>
</div>
</div>
</div>
</footer>
This is my CSS for this section:
footer {
height: 60px;
width: 100%;
font-size: 14px;
position: absolute;
background-color: #2A3E47;
font-family: 'Contrail One', cursive;
margin: 0px 10px 0px 10px;
text-align:center;
}
footer.a{
display:inline-block;
margin:0 auto 0 auto;
}
h7{
color:#FFF;
font-size:24px;
font-family: 'Contrail One', cursive;
text-align:center;
}
I can't seem to figure this out, I've drawn it out on a couple sheets of paper, but I can seem to style like like I'd like. Can anyone point out where I'm going wrong?
After trying your the posted code I found that you are using wrong quote pair.
Also the css you gave isn't designed to achieve the goal.
I made a working fiddle here. Check it out
HTML:
<footer>
<div class="container">
<div class="row">
<div class="col-md-6 parent">
<p>GET SOCIAL WITH US!</p>
<div class="icon">
<img src="https://myapnea.org/assets/myapnea/icons/facebook_icon-7eedcb8837293505e1d3b1494ff19c9c3842340d1dfcd193e098e2b44f34456b.png" alt="Follow us on Facebook">
<img src="http://frcgamesense.com/dnn/portals/0/Home/Twitter_icon.png" alt="Follow us on Twitter">
<img src="https://store-images.s-microsoft.com/image/apps.36749.9007199266245564.6701eae8-16d2-4ba0-bdaa-8d9d9f9a1e70.03e5f6a9-3866-4ad9-9f2b-6b57ff90419e?w=100&h=100&q=60" alt="Link In with Us"></div>
</div>
<div class="col-md-6">
<p class="copyright">© 2016 COPYRIGHT LINE</p>
</div>
</div>
</div>
</footer>
CSS:
footer {
padding: 5px;
height: 100px;
width: 100%;
font-size: 14px;
position: absolute;
background-color: #2A3E47;
font-family: 'Contrail One', cursive;
margin: 0px 10px 0px 10px;
text-align:center;
}
.copyright {
padding-top: 40px;
}
footer p {
color: #fff;
}
footer a img {
display: inline-block;
width:50px;
}
.parent .icon {
margin: auto 7px;
}
It looks like your second col-sm-6 is nested too deep. It should be at the same level of the other one, not within it. Your divs are all sitting on half the grid (6 wide) and then the three social logos are taking half of that, and the copyright bit is taking the other half. You need the col-sm-6 divs to be siblings.
Furthermore, I don't think col-sm-6 looks like it'll work, looking at what you're trying to achieve. You might want to make the first group col-sm-3 or so and add an offset class to the copyright part. :-)
There are at least 3 errors in your HTML markup:
<h7>GET SOCIAL WITH US!</h7>
<div class="container'>
The ending quote should be double ("), not single (')
Since you place it in a column, the class name of this tag should be container-fluid, not container
</div>
<div class="row">
<div class="col-sm-6">
Missing close tag, the div .row is not neccessary.
</div>
</div>
</div>
<div class="col-sm-6">
Please see the fixed code here

Align elements in the middle

I all, i've this part of code
HTML:
<div id="services"></div>
<div class="modular-row features small">
<div class="content-inner">
<h1>Für alle Ihre Werte</h1>
<div class="feature-items">
<div class="feature">
<img style="" src="/sdstest/user/pages/01.home/_01.services/icon1.png" />
<div class="feature-content icon-offset">
<h4>Rechenzentrum</h4>
</div>
</div>
<div class="feature">
<img style="" src="/sdstest/user/pages/01.home/_01.services/icon2.png" />
<div class="feature-content icon-offset">
<h4>Kollaboration</h4>
</div>
</div>
<div class="feature">
<img style="" src="/sdstest/user/pages/01.home/_01.services/icon3.png" />
<div class="feature-content icon-offset">
<h4>Archiv</h4>
</div>
</div>
<div class="feature">
<img style="" src="/sdstest/user/pages/01.home/_01.services/icon4.png" />
<div class="feature-content icon-offset">
<h4>Wertsachen</h4>
</div>
</div>
</div>
</div>
CSS:
.feature { margin-right: 2rem; }
What i need is
1: to center the class="feature" elements in the middle
2: have a bit of space between that elements (as is it now).
But this is result:
How can i solve it?
(Demo): https://jsfiddle.net/kf3u042k/
You can change css somthing like this
.modular .features .feature {
display: block;
float: left;
margin-bottom: 1rem;
margin-top: 2rem;
vertical-align: top;
width: 24%;
}
.feature {
margin-right: 15px;
}
Try to add this code into your stylesheet. .feature{
margin-left:auto;
margin-right:auto;
max-width:900px;
}
You have to fix the width and then put your side margin on auto. It would be something like this:
.feature{
max-width:900px;
margin-left:auto;
margin-right:auto;
padding-left: x px;
}
for the space just ad a padding-left on your feature (cf code). Still if your width is not large enough it will go bad

Height works in pixels, not in percentages

I am trying to create a simple menu using the following html setup:
<div class="container">
<div class="container-cell">
<a href="play.html">
<div class="menu-option no-margintop">
<div class="play-icon">
<span class="helper"></span><img src="./img/icon_1.png"/>
</div>
<div class="menu-text"><span>Play</span></div>
</div>
</a>
<a href="index.html">
<div class="menu-option">
<div class="play-icon">
<span class="helper"></span><img src="./img/icon_3.png"/>
</div>
<div class="menu-text"><span>Highscore</span></div>
</div>
</a>
<a href="index.html">
<div class="menu-option">
<div class="play-icon">
<span class="helper"></span><img src="./img/icon_2.png"/>
</div>
<div class="menu-text"><span>FAQ</span></div>
</div>
</a>
</div>
</div>
In the process of creating this, I made a switch from hard pixels to percentages. Whereas the pixel version of setting hights works, it does not seem to work in percentages. The hight for one particular class, menu-option, does not seem to get picked up by the browser.
I have been searching for a while, and the only solutions I came across, was setting a height to both the body and html (100%). I have also set a height to any of the container-elements.
See css below:
html, body{
height:100%;
}
.container {
display:table;
width:100%;
height:70%;
}
.container-cell {
display:table-cell;
vertical-align: middle;
height:100%;
}
.menu-option{
width:90%;
margin-left:5%;
border-radius:10px;
background-color:rgba(17,23,28,0.2);
height:6.94%;
margin-top:5%;
font-size:150%;
}
Why is the browser not picking up on the height in percentage and how can make it use the height in percentage?
Add display: inline-block; to your menu-option class for the height property to work. Something like this:
.menu-option{
display: inline-block;
width:90%;
margin-left:5%;
border-radius:10px;
background-color:rgba(17,23,28,0.2);
height:6.94%;
margin-top:5%;
font-size:150%;
}
Here's a jsfiddle of the above: https://jsfiddle.net/AndrewL32/e0d8my79/17/

Hover on div element does not do the effect individually

I have multiple divs with the same class of "product". When I hover on each product element, I need them to have a hover effect, but the problem is that when I hover over the first element, all other elements also have the effect applied rather than just the one i hovered. What am i doing wrong?
<style>
div.product{
width:90%;
margin:10px auto;
height: 200px;
transition: all 0.1s ease;
background-color: #069;
}
div.product:hover{
margin-top:-5px;
}
.img_box{
width:50%;
height:100%;
padding: 10px;
float:left;
box-sizing: border-box;
}
.desc_box{
width:50%;
height:100%;
float:left;
padding: 10px;
box-sizing: border-box;
}
.img{
background-color: #b65050;
height: 100%;
}
.desc{
background-color: chocolate;
height: 100%;
}
</style>
HTML:
<div>
<div class="product">
<div class="img_box">
<div class="img">
image
</div>
</div>
<div class="desc_box">
<div class="desc">
desc
</div>
</div>
</div>
<div class="product">
<div class="img_box">
<div class="img">
image
</div>
</div>
<div class="desc_box">
<div class="desc">
desc
</div>
</div>
</div>
<div class="product">
<div class="img_box">
<div class="img">
image
</div>
</div>
<div class="desc_box">
<div class="desc">
desc
</div>
</div>
</div>
<div class="product">
<div class="img_box">
<div class="img">
image
</div>
</div>
<div class="desc_box">
<div class="desc">
desc
</div>
</div>
</div>
</div>
heres my fiddle: MY FIDDLE
This is because you are floating the divs. Changing margin-top moves the element which creates room underneath it.
What you need is this:
div.product{
position:relative;
}
div.product:hover{
top:-5px;
}
position:relative basically takes up the original space but lets the div to be rendered elsewhere.