Columns don't act responsive even though #media is set? [duplicate] - html

This question already has answers here:
Why media queries has less priority than no media queries css
(2 answers)
Understanding CSS selector priority / specificity
(4 answers)
Closed 2 years ago.
I've created these to text boxes and want to add responsiveness to them, however, adding the #media doesn't work for some reason. I want the the right box move under the left box when the screen size is under x pixels.
/* CSS Document */
* {
box-sizing: border-box;
}
#fullbodybg {
margin-top: 20%;
}
/* Create two unequal columns that floats next to each other */
.column {
float: left;
padding: 10px;
height: auto;
/* Should be removed. Only for demonstration */
}
#media screen and (max-width: 1000px) {
.column {
width: 100%;
}
}
.left {
margin-left: 10%;
width: 25%;
}
.right {
margin-right: 10%;
width: 55%;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
.row {
font-family: lato;
font-style: normal;
font-weight: 100;
font-size: 15px;
text-align: left;
}
<div class="row">
<div class="column left">
<h2>Angaben gemäß § 5 TMG</h2>
<p>Max Muster<br>Musterweg<br>12345 Musterstadt<br><br>Vertreten durch:<br>Max Muster<br><br>Kontakt:<br>Telefon: 01234-789456<br>Fax: 1234-56789<br>E-Mail: max#muster.de<br><br>Umsatzsteuer-ID:<br>Umsatzsteuer-Identifikationsnummer gemäß
§27a Umsatzsteuergesetz: Musterustid.<br><br>Wirtschafts-ID:<br>Musterwirtschaftsid<br><br>Aufsichtsbehörde:<br>Musteraufsicht Musterstadt</p>
</div>
<div class="column right">
<h2>Haftungsausschluss:</h2>
<p>Zweck einverstanden.</p>
</div>
</div>

It is about how css prioritizes, you can google and read it. there are some
rules.
In your case, you can either put the #media query below your left and right CSS (media at the bottom is best). Or add important to the CSS in the media query (which not a good practice but will do the job).
Solution 1.
* {
box-sizing: border-box;
}
#fullbodybg {
margin-top: 20%;
}
/* Create two unequal columns that floats next to each other */
.left {
margin-left: 10%;
width: 25%;
}
.right {
margin-right: 10%;
width: 55%;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
.row {
font-family: lato;
font-style: normal;
font-weight: 100;
font-size: 15px;
text-align: left;
}
.column {
float: left;
padding: 10px;
height: auto;
/* Should be removed. Only for demonstration */
}
#media screen and (max-width: 1000px) {
.column {
width: 100%;
}
}
<div class="row">
<div class="column left">
<h2>Angaben gemäß § 5 TMG</h2>
<p>Max Muster<br>Musterweg<br>12345 Musterstadt<br><br>Vertreten durch:<br>Max
Muster<br><br>Kontakt:<br>Telefon: 01234-789456<br>Fax: 1234-56789<br>E-Mail:
max#muster.de<br><br>Umsatzsteuer-ID:<br>Umsatzsteuer-Identifikationsnummer gemäß §27a
Umsatzsteuergesetz:
Musterustid.<br><br>Wirtschafts-ID:<br>Musterwirtschaftsid<br><br>Aufsichtsbehörde:<br>Musteraufsicht
Musterstadt</p>
</div>
<div class="column right">
<h2>Haftungsausschluss:</h2>
<p>Zweck einverstanden.</p>
</div>
</div>
Solution 2.
/* CSS Document */
* {
box-sizing: border-box;
}
#fullbodybg {
margin-top: 20%;
}
/* Create two unequal columns that floats next to each other */
.column {
float: left;
padding: 10px;
height: auto; /* Should be removed. Only for demonstration */
}
#media screen and (max-width: 1000px) {
.column {
width: 100% !important;
}
}
.left {
margin-left: 10%;
width: 25%;
}
.right {
margin-right: 10%;
width: 55%;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
.row {
font-family: lato;
font-style: normal;
font-weight: 100;
font-size: 15px;
text-align: left;
}
<div class="row">
<div class="column left">
<h2>Angaben gemäß § 5 TMG</h2>
<p>Max Muster<br>Musterweg<br>12345 Musterstadt<br><br>Vertreten durch:<br>Max
Muster<br><br>Kontakt:<br>Telefon: 01234-789456<br>Fax: 1234-56789<br>E-Mail:
max#muster.de<br><br>Umsatzsteuer-ID:<br>Umsatzsteuer-Identifikationsnummer gemäß §27a
Umsatzsteuergesetz:
Musterustid.<br><br>Wirtschafts-ID:<br>Musterwirtschaftsid<br><br>Aufsichtsbehörde:<br>Musteraufsicht
Musterstadt</p>
</div>
<div class="column right">
<h2>Haftungsausschluss:</h2>
<p>Zweck einverstanden.</p>
</div>
</div>

Your main issue is actually the order of your styles. What happens is that your style in .left and .right overrides your #media style. This should be a quick fix:
/* CSS Document */
* {
box-sizing: border-box;
}
#fullbodybg {
margin-top: 20%;
}
/* Create two unequal columns that floats next to each other */
.column {
float: left;
padding: 10px;
height: auto; /* Should be removed. Only for demonstration */
}
.left {
margin-left: 10%;
width: 25%;
}
.right {
margin-right: 10%;
width: 55%;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
.row {
font-family: lato;
font-style: normal;
font-weight: 100;
font-size: 15px;
text-align: left;
}
#media screen and (max-width: 1000px) {
.column {
width: 100%;
}
}
I simply moved #media at the end to make sure it overrides all other styles when it meets the requirements you've set.

Related

Centering a set of columns in a row AND be responsive AND equal height in bootstrap?

I want to have a set of columns in a row that are centered in the row, and have equal height, and space between them, also be responsive and display vertical on a phone or other small device.
css:
/* CSS used here will be applied after bootstrap.css */
.my-well {
margin: 10px;
border-radius:20px;
background-color: White;
}
#media (min-width: 480px) {
.foo {
margin: 20px !important;
}
}
/* from http://www.minimit.com/articles/solutions-tutorials/bootstrap-3-responsive-columns-of-same-height */
/* centered columns styles */
.row-centered {
text-align:center;
}
.col-centered {
display:inline-block;
float:none;
/* reset the text-align */
text-align:left;
}
/* content styles */
.inside {
margin-top: 10px;
margin-bottom: 10px;
}
.inside-full-height {
/*
// if you want to give content full height give him height: 100%;
// with content full height you can't apply margins to the content
// content full height does not work in ie http://stackoverflow.com/questions/27384433/ie-display-table-cell-child-ignores-height-100
*/
height: 90%;
margin-top: 0;
margin-bottom: 0;
}
/* columns of same height styles */
.row-height {
display: table;
table-layout: fixed;
height: 100%;
width: 100%;
}
.col-height {
display: table-cell;
float: none;
height: 100%;
}
.col-top {
vertical-align: top;
}
.col-middle {
vertical-align: middle;
}
.col-bottom {
vertical-align: bottom;
}
#media (min-width: 480px) {
.row-xs-height {
display: table;
table-layout: fixed;
height: 100%;
width: 100%;
}
.col-xs-height {
display: table-cell;
float: none;
height: 100%;
}
.col-xs-top {
vertical-align: top;
}
.col-xs-middle {
vertical-align: middle;
}
.col-xs-bottom {
vertical-align: bottom;
}
}
#media (min-width: 768px) {
.row-sm-height {
display: table;
table-layout: fixed;
height: 100%;
width: 100%;
}
.col-sm-height {
display: table-cell;
float: none;
height: 90%;
}
.col-sm-top {
vertical-align: top;
}
.col-sm-middle {
vertical-align: middle;
}
.col-sm-bottom {
vertical-align: bottom;
}
}
#media (min-width: 992px) {
.row-md-height {
display: table;
table-layout: fixed;
height: 100%;
width: 100%;
}
.col-md-height {
display: table-cell;
float: none;
height: 100%;
}
.col-md-top {
vertical-align: top;
}
.col-md-middle {
vertical-align: middle;
}
.col-md-bottom {
vertical-align: bottom;
}
}
#media (min-width: 1200px) {
.row-lg-height {
display: table;
table-layout: fixed;
height: 100%;
width: 100%;
}
.col-lg-height {
display: table-cell;
float: none;
height: 100%;
}
.col-lg-top {
vertical-align: top;
}
.col-lg-middle {
vertical-align: middle;
}
.col-lg-bottom {
vertical-align: bottom;
}
}
Html:
<div class="container" style="background-color: pink;">
<div class="row row-centered row-xs-height foo">
<div class="well my-well col-xs-11 col-sm-3 col-centered col-xs-height">
<div class="inside-full-height">
Faultily crud dear far trying yet dainty fluent sedately sent enthusiastic however and returned one much cat much beneficently selfishly evident unblushing wow after gradual raptly jeepers due under but.
</div>
</div>
<div class="well my-well col-xs-11 col-sm-3 col-centered col-xs-height">
<div class="inside-full-height">
Tautly doggedly at reserved cardinal when far magnanimously the and close wow buffalo jeepers disgracefully wow well dolorous inflexible primly that immorally.
</div>
<div></div>
</div>
<div class="well my-well col-xs-11 col-sm-3 col-centered col-xs-height">
<div class="inside-full-height">
Faultily crud dear far trying yet dainty fluent sedately sent enthusiastic however and returned one much cat much beneficently selfishly evident unblushing wow after gradual raptly jeepers due under but. Far sloth hardheaded some wherever chivalrous and far some yikes crud humane extravagantly emoted however untiringly the antelope ouch anticipative scallop off hyena played tortoise pounded.
</div>
<div></div>
</div>
</div class="row row-centered row-sm-height">
</div class="container" style="background-color: pink;">
results:
Desktop view
Phone view
I'm ok with the phone rendering, but I'd like margins between the items in the desktop view. I've been messing with it for several days, and tried multiple solutions from the web, be making the centering & fixed height play together with responsiveness has eluded me.
Use the following:
.container-row {display: flex;flex-wrap: wrap;flex-direction: row;justify-content: center;align-items: stretch;align-content: stretch;}
.container-col{
display: inline-block;
margin: 20px auto;
}
This is what i done here for example http://www.widest.eu/news

Centering table with more rows

I have three numbers in a div element that is set to display table. I need to center numbers when they are divided in more rows for better experience on narrow devices.
Please run code snippet at full page and then reduce screen size (356px for example).
What I want:
case1: margin|div|div|div|margin
--------------------------------
case2: margin|div|div|margin
margin|div| |margin
--------------------------------
case3: margin|div|margin
margin|div|margin
margin|div|margin
Solved! ...added code + eddited snippet, feel free to try :)
Edit1: There´s aboutqi class which is set to display: table and margin: auto. On wide screen there is only one row and margin works perfect = it´s centered. But when there are 2 or 3 rows margin stop works and aboutqiitems are not centered.
.aboutqi {
margin: auto;
display: table;
}
.aboutqiitems {
float: left;
}
.aboutqiitem {
float: left;
margin-right: 0px;
margin-bottom: 30px;
width: 200px;
}
.aboutqiitem-inner {
width: 100%;
margin: auto;
}
.num {
margin: 0px;
margin-bottom: 20px;
padding-left: 13px;
font-size: 48px;
font-weight: bold;
color: #014493;
}
.num-center {
margin: auto;
display: table;
}
.num-center-last {
margin: auto;
display: table;
position: relative;
left: -7px;
}
/* My solution */
.aboutqiitems-solved {
float: left;
}
#media screen and (max-width: 616px) {
.aboutqiitems-solved {
max-width: 100%;
clear: both;
padding-left: calc((100% - 400px)/2);
}
}
#media screen and (max-width: 416px) {
.aboutqiitems-solved {
max-width: 100%;
clear: both;
padding-left: calc((100% - 200px)/2);
}
}
#media screen and (max-width: 216px) {
.aboutqiitems-solved {
max-width: 100%;
clear: both;
padding-left: 0px;
}
}
<div class="aboutqi">
<p>Hello, need to center numbers when there is more than 1 row.</p>
<div class="aboutqiitems">
<div class="aboutqiitem">
<div class="aboutqiitem-inner">
<div class="num-center"><p class="num">1</p></div>
</div>
</div>
<div class="aboutqiitem">
<div class="aboutqiitem-inner">
<div class="num-center"><p class="num">2</p></div>
</div>
</div>
<div class="aboutqiitem last">
<div class="aboutqiitem-inner">
<div class="num-center-last"><p class="num">3</p></div>
</div>
</div>
</div>
</div>
</br>
</br>
<!-- My Solution -->
<div class="aboutqi">
<p>How I solve it. Fell free to change page width :)</p>
<div class="aboutqiitems-solved">
<div class="aboutqiitem">
<div class="aboutqiitem-inner">
<div class="num-center"><p class="num">1</p></div>
</div>
</div>
<div class="aboutqiitem">
<div class="aboutqiitem-inner">
<div class="num-center"><p class="num">2</p></div>
</div>
</div>
<div class="aboutqiitem last">
<div class="aboutqiitem-inner">
<div class="num-center-last"><p class="num">3</p></div>
</div>
</div>
</div>
</div>
Example: http://www.dcit.sk/ ... almost at the bottom of the page
You should use media queries in your CSS sheet to help with this. It looks like your numbers are splitting onto 2 rows around 616px, so you want to do something along the following lines:
#media screen and (max-width: 616px) {
.aboutqiitems {
width: 100%;
}
.aboutqiitem {
display: block;
clear: both;
width: 100%;
}
}
Here is a jsfiddle that shows the extra code and how it works: https://jsfiddle.net/4be1k4jr/
You can read more about media queries and how to use them here:
http://www.w3schools.com/cssref/css3_pr_mediaquery.asp
If you're looking to keep the boxes at 200px instead of 100% (in case you have images or something) you can use the following media query. It's a little less clean, but works if you absolutely must keep 200px.
#media screen and (max-width: 616px) {
.aboutqiitems {
width: 100%;
}
.aboutqiitem {
display: block;
clear: both;
width: 200px;
position: relative;
left: 50%;
margin-left: -100px;
}
}
From what I'm taking from this question, you want to change the css when the screen width gets to a certain width. The easiest way to do this is with an #media tag.
Here's my css solution to this problem.
<style>
.aboutqi {
margin: auto;
display: table;
}
.aboutqiitems {
float: left;
}
.aboutqiitem {
float: left;
margin-right: 0px;
margin-bottom: 30px;
width: 200px;
}
.aboutqiitem-inner {
width: 100%;
margin: auto;
}
.num {
margin: 0px;
margin-bottom: 20px;
padding-left: 13px;
font-size: 48px;
font-weight: bold;
color: #014493;
}
.num-center {
margin: auto;
display: table;
}
.num-center-last {
margin: auto;
display: table;
position: relative;
left: -7px;
}
#media only screen and (max-width: 615px){
.aboutqiitem{
width: 100%;
}
.aboutqiitems{
width: 100%;
}
.num{
padding: 0;
}
.num-center-last {
left: 0;
}
}
</style>
Keep in mind that you also need to set a viewport width with a meta tag in your head tag.
<meta content="width=device-width" name="viewport">
This would also work:
#media only screen and (max-width: 615px){
.aboutqiitems{
float: none;
}
.aboutqiitem{
float: none;
margin: auto;
}
.num-center-last{
position: inherit;
}
}

How to center vertical inside header?

I am creating a responsive header. I got two columns and want the button in the right column to be vertical centered.
I know I can center items using top: 50%; margin-top: -xy px, and my button although got a fixed height: 40px.
To use this method I wrapped my button inside a div {position: relative}. This does not work, as the div does not stretch its own height.
How can I solve this with css? First I thought about Flexbox, but it has quite some lack of browser compatibility.
JSFIDDLE DEMO
You can greatly simplify your code - remove floats, (use display: inline-block instead), remove the .relative div, etc.
Working Fiddle
html, body {
margin: 0;
padding: 0;
font-size: 16px;
}
header {
background: red;
color: #fff;
padding: 0.5em;
}
header h1 {
font-size: 2em;
margin: 0 0 0.2em;
}
header p {
margin: 0;
}
header button {
height: 40px;
width: 70px;
}
.column-left {
display:inline-block;
width: 70%;
vertical-align: middle;
}
.column-right {
width: 29%;
text-align: right;
display: inline-block;
vertical-align: middle;
height: 100%;
}
/* responsive */
#media (min-width: 200px) {
header {
padding: 1em;
}
}
#media (min-width: 300px) {
header {
padding: 1.5em;
}
}
#media (min-width: 400px) {
header {
padding: 2em;
}
}
#media (min-width: 500px) {
header {
padding: 2.5em;
}
}
#media (min-width: 600px) {
header {
padding: 3em;
}
}
/* helpers */
.clearfix:after {
content: ".";
clear: both;
display: block;
visibility: hidden;
height: 0px;
}
Remove this div with position: relative and add position: relative to your header tag. You can even delete your column-right div.
Another solution:
header button {
top: 50%;
transform: translateY(-50%); // instead of negative margin-top (it is useful when your button has dynamic height, supports IE9+ with -ms- prefix)
}
JSFIDDLE

CSS Responsive Mobile Issue - Foundation Front-end framework ( ZURB)

My website uses a Foundation Front-end framework for my website, so it's a responsive design for mobile devices.
I have an issue, with how the data is displayed on my website when used on a mobile.
I would like the sidebar widget contents on my website to display above the items (health clubs) on the mobile version of the website. See my sidebar widget has a filter section, So I really need that displayed before the (health clubs).
Question: What do I need to change to display the sidebar widget on top? Apologises I'm ok at CSS but this is pretty advanced for my skill level.
Here is the website: (PC version)
http://s10.postimg.org/cl1n43w95/website.png
Here is how the website is displayed on the mobile. Note How my items are all above the sidebar. I'd like the sidebar widget above the items:
http://s27.postimg.org/8adw402gz/screenshot2_sidebarunder_items.png
Here is the foundation code I believe I need to change:
/* #Foundation Style
================================================== */
.row .column, .row .columns{ -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }
.container{ margin: 0px auto; max-width: 960px; padding: 0px 20px; }
.container.wrapper{ margin: 0px auto; max-width: 1000px; padding: 0px; }
.row { width: 1140px; max-width: 100%; min-width: 727px; margin: 0 auto; }
.row .row { width: auto; max-width: none; min-width: 0; margin: 0 -10px; }
.column, .columns { float: left; min-height: 1px; padding: 0 10px; position: relative; margin-bottom: -12px; }
.row .one { width: 8.333%; }
.row .two { width: 16.667%; }
.row .three { width: 25%; }
.row .four { width: 33.333%; }
.row .five { width: 41.667%; }
.row .six { width: 50%; }
.row .seven { width: 58.333%; }
.row .eight { width: 66.667%; }
.row .nine { width: 75%; }
.row .ten { width: 83.333%; }
.row .eleven { width: 91.667%; }
.row .twelve { width: 100%; }
.row .one-fifth{ width: 20%; }
.row .one-sixth{ width: 16.667; }
img{ max-width: 100%; height: auto; }
img { -ms-interpolation-mode: bicubic; }
object, embed { max-width: 100%; }
/* #Foundation Mobile Size
================================================== */
#media only screen and (max-width: 767px) {
body { -webkit-text-size-adjust: none; -ms-text-size-adjust: none;
width: 100%; min-width: 0; margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }
.container{ margin: 0px auto; max-width: 420px; }
.container.wrapper{ margin: 0px auto; max-width: 460px; padding: 0px; }
.row { width: auto; min-width: 0; margin-left: 0; margin-right: 0; }
.row .column, .row .columns { width: 100%; float: none; }
.column:last-child, .columns:last-child { float: none; }
[class*="column"] + [class*="column"]:last-child { float: none; }
.column:before, .columns:before, .column:after, .columns:after { content: ""; display: table; }
.column:after, .columns:after { clear: both; }
}
/* #Custom Style
================================================== */
/*--- header area ---*/
.header-wrapper .responsive-menu-wrapper{ display: none; }
/* #Custom Mobile size
================================================== */
#media only screen and (max-width: 767px) {
/*--- header area ---*/
.header-wrapper .logo-wrapper{ float: none; }
.header-wrapper .navigation-wrapper{ display: none; }
.header-wrapper .responsive-menu-wrapper{ display: block; }
.header-wrapper .top-search-form{ display: none; }
div.logo-right-text{ float: none !important; text-align: center !important;
padding-top: 0px !important; padding-bottom: 20px; }
div.feedback-wrapper{ display: none; }
div.top-navigation-left, div.top-navigation-right{ text-align: center; float: none; }
div.social-wrapper { float: none; display: inline-block; margin-top: 5px; }
/*--- single page ---*/
div.single-portfolio .port-media-wrapper { max-width: 100%; width: 100%; float: none; margin-bottom: 20px; }
div.single-portfolio .port-content-wrapper { overflow: visible; }
div.single-portfolio .port-nav .port-prev-nav, div.single-portfolio .port-nav .port-next- nav { margin-bottom: 15px; }
/*--- page item ---*/
div.gdl-blog-medium .blog-media-wrapper { margin-right: 0px; width: 100%; }
div.gdl-blog-medium .blog-context-wrapper { overflow: visible; }
div.price-item{ margin-bottom: 20px; }
div.column-service-row{ border-left-width: 0px; }
/*--- shortcode ---*/
.shortcode1-4, .shortcode1-4.last,
.shortcode1-3, .shortcode1-3.last,
.shortcode1-2, .shortcode1-2.last,
.shortcode2-3, .shortcode2-3.last,
.shortcode3-4, .shortcode3-4.last,
.shortcode1-5, .shortcode1-5.last,
.shortcode2-5, .shortcode2-5.last,
.shortcode3-5, .shortcode3-5.last,
.shortcode4-5, .shortcode4-5.last{ width: 100%; }
/*--- slider ---*/
.flex-caption{ display: none !important; }
.nivo-caption{ display: none !important; }
.anythingSlider{ display: none !important; }
/*--- footer ---*/
div.copyright-left, div.copyright-right{ float: none; text-align: center; }
}
Thanks Guys, Sorry if i'm not very clear.
With the foundation grid you can change the order of columns, which is probably what you are looking for.
http://foundation.zurb.com/docs/components/grid.html
Look for "Source Ordering"
That should guide you on the right path. Otherwise it would be helpful if you post the relevant markup.
second attempt
If you look at the source of your second page http://goo.gl/ijZ1JF you find three elements:
<div class="row single page"> ...
<div class="eight column columnopaddingright"> ...
<div class="four column columnopaddingleft"> ...
Do you get the desired result if you modify them for testing purpose like this?
<div class="row single page" style="display: table;">
<div class="eight column columnopaddingright" style="display: table-footer-group;">
<div class="four column columnopaddingleft" style="display: table-header-group;">

Responsive Divs are overlapping

I have a code at http://jsfiddle.net/N7nj5/
CSS:
/* ================================================================ Pre-footer Advert pfa =========================================================== */
#pre-footer-ad-container {
width: 95%;
height: 100px;
margin-left: 2.5%;
margin-right: 2.5%;
}
.pre-footer-ad {
width: 100%;
height: 100px;
}
/* SECTIONS */
.sectionpfa {
clear: both;
padding: 0px;
margin: 0px;
}
/* COLUMN SETUP */
.colpfa {
height: 100px;
display: block;
float:left;
margin: 1% 0 1% 1%;
background-color: #f00;
}
.colpfa:first-child { margin-left: 0; }
/* GROUPING */
.grouppfa:before,
.grouppfa:after {
content:"";
display:table;
}
.grouppfa:after {
clear:both;
}
.grouppfa {
zoom:1; /* For IE 6/7 */
}
/* GRID OF TWO */
.pfaspan_2_of_2 {
width: 100%;
}
.pfaspan_1_of_2 {
width: 49.5%;
}
/* GO FULL WIDTH AT LESS THAN 480 PIXELS */
#media only screen and (max-width: 480px) {
.colpfa {
margin: 1% 0 1% 0%;
}
}
#media only screen and (max-width: 480px) {
.pfaspan_2_of_2 {
width: 100%;
}
.pfaspan_1_of_2 {
width: 100%;
}
}
/* ================================================================ Footer Content ================================================================ */
#footer-container {
margin-top: 40px;
width: 100%;
height: auto;
background-color:#16a085;
color: #ffffff;
}
.footer {
width: 95%;
height: 300px;
margin-left:2.5%;
margin-right: 2.5%;
background-color:#16a085;
}
/* SECTIONS */
.sectionfooter {
clear: both;
padding: 0px;
margin: 0px;
}
/* COLUMN SETUP */
.colfooter {
display: block;
float:left;
margin: 1% 0 1% 2%;
}
.colfooter:first-child { margin-left: 0; }
/* GROUPING */
.groupfooter:before,
.groupfooter:after {
content:"";
display:table;
}
.groupfooter:after {
clear:both;
}
.groupfooter {
zoom:1; /* For IE 6/7 */
}
/* GRID OF THREE */
.footerspan_3_of_3 {
width: 23%;
}
.footerspan_2_of_3 {
width: 24%;
}
.footerspan_1_of_3 {
width: 49%;
}
/* GO FULL WIDTH AT LESS THAN 480 PIXELS */
#media only screen and (max-width: 480px) {
.colfooter {
margin: 1% 0 1% 0%;
}
}
#media only screen and (max-width: 480px) {
.footerspan_3_of_3 {
width: 100%;
}
.footerspan_2_of_3 {
width: 100%;
}
.footerspan_1_of_3 {
width: 100%;
}
}
HTML:
<!-- Pre-Footer Advertisement pfa -->
<div id="pre-footer-ad-container">
<div class="pre-footer-ad">
<div class="sectionpfa grouppfa">
<div class="colpfa pfaspan_1_of_2">
This is column 1
</div>
<div class="colpfa pfaspan_1_of_2">
This is column 2
</div>
</div>
</div>
</div>
<!-- Footer Content -->
<div id="footer-container">
<div class="footer">
<div class="sectionfooter groupfooter">
<div class="colfooter footerspan_1_of_3">
Testimonials
</div>
<div class="colfooter footerspan_2_of_3">
Legal
</div>
<div class="colfooter footerspan_3_of_3">
Other Links
</div>
</div>
</div>
</div>
Problem Definition:
There are two parts:
1. the columns in red color
2. the column in torquise color
They are responsive.
When I reduce the width of the screen, the red ones overlap the torquise one.
I DONT WANT THAT TO HAPPEN!!!
I want that when the site is displayed on a mobile screen, the red and torquise regions should not overlap.
Currently when i reduce the screen resolution, the red ones come one below the other, which is perfect. but the same should happen with the torquise one also.
Please Help!!!
Just clear the footer-container
#footer-container {
margin-top: 40px;
width: 100%;
height: auto;
background-color:#16a085;
color: #ffffff;
clear: both; /* <--- */
}
FIDDLE
Use min-height for test instead height, or reset height too via your queries.
Tes with min-height: http://jsfiddle.net/N7nj5/1/