I'd like to know why my code is adding this almost ghost margin of 10px? No matter what I do the .wrapper and everything in it seems to ignore the right -10px of margin???
***I first forgot to mention that the whole thing is border-box
Here's the code:
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.container{
position: relative;
width: 90%;
margin: 0 auto;
padding: 0 10px;
}
.wrapper{
width:100%;
max-width: none;
margin-left: -10px;
margin-right: -10px;
}
.col-m1, .col-m2, .col-m3,
.col-m4, .col-m5, .col-m6,
.col-m7, .col-m8, .col-m9,
.col-m10, .col-m11, .col-m12,
.col-l1, .col-l2, .col-l3,
.col-l4, .col-l5, .col-l6,
.col-l7, .col-l8, .col-l9,
.col-l10, .col-l11, .col-l12,
.col-xl1, .col-xl2, .col-xl3,
.col-xl4, .col-xl5, .col-xl6,
.col-xl7, .col-xl8, .col-xl9,
.col-xl10, .col-xl11, .col-xl12 {
width: 100%;
position: relative;
float: left;
padding:0 10px;
}
#media (min-width: 768px) {
.container {
width: 720px;
}
.col-m1, .col-l1, .col-xl1 { width: 8.333%; }
.col-m2, .col-l2, .col-xl2 { width: 16.666%; }
.col-m3, .col-l3, .col-xl3 { width: 24.999%; }
.col-m4, .col-l4, .col-xl4 { width: 33.333%; }
.col-m5, .col-l5, .col-xl5 { width: 41.666%; }
.col-m6, .col-l6, .col-xl6 { width: 49.999%; }
.col-m7, .col-l7, .col-xl7 { width: 58.333%; }
.col-m8, .col-l8, .col-xl8 { width: 66.666%; }
.col-m9, .col-l9, .col-xl9 { width: 74.999%; }
.col-m10, .col-l10, .col-xl10 { width: 83.333%; }
.col-m11, .col-l11, .col-xl11 { width: 91.666%; }
.col-m12, .col-l12, .col-xl12 { width: 100%; }
.offset-col-m1 { margin-left: 8.333%; }
.offset-col-m2 { margin-left: 16.666%; }
.offset-col-m3 { margin-left: 24.999%; }
.offset-col-m4 { margin-left: 33.333%; }
.offset-col-m5 { margin-left: 41.666%; }
.offset-col-m6 { margin-left: 49.999%; }
.offset-col-m7 { margin-left: 58.333%; }
.offset-col-m8 { margin-left: 66.666%; }
.offset-col-m9 { margin-left: 74.999%; }
.offset-col-m10 { margin-left: 83.333%; }
.offset-col-m11 { margin-left: 91.666%; }
}
THE HTML
Some HTML markup for the site. This is specifically the image grid on the homepage. But the whole site has this problem.
This is an image of the non-extension/extra margin on the right side. Very annoying and I just don't understand.
Remove width: 100% of the wrapper class.
Related
I have a page with a simple 2 column CSS table inside a general container div, like so:
#container:after {
content: "";
display: table;
clear: both;
}
#col_1 {
float: left;
width: 50%;
padding-right: 20px;
}
#col_2 {
width: 50%;
}
It works correctly on computers but on mobile the two columns overlap/overlay and I would like col2 to go underneath col1. In other words float ONLY if there is room for both, otherwise become two rows.
How can I do that?
Thank you
Since I don't have your HTML code, I can only do a mock-up by myself. Add media query for breakpoint for the mobile device.
html,
body,
#container {
width: 100%;
margin: 0;
}
#container:after {
content: "";
display: table;
clear: both;
}
#col_1 {
float: left;
width: 50%;
height: 100px;
padding-right: 20px;
background: orange;
}
#col_2 {
float: left;
width: calc(50% - 20px); /* The 20px is the padding-right of the col_1 */
height: 100px;
background: lime;
}
#media screen and (max-width: 576px) {
#col_1 {
width: 100%;
}
#col_2 {
width: 100%;
}
}
<div id="container">
<div id="col_1"></div>
<div id="col_2"></div>
</div>
The star rating using Font Awesome defined by width provided below is working fine on Chrome and Firefox, but on Edge and IE doesn't. Anyone know what could it be?
JSFiddle
Chrome and Firefox
Edge and IE
.star-rating {
display: inline-block;
position: relative;
line-height: 1;
}
.star-rating:before,
.star-rating:after {
content: "\f005\f005\f005\f005\f005";
display: block;
font-family: "FontAwesome";
font-size: 25px;
color: #ccc;
}
.star-rating:after {
color: gold;
position: absolute;
top: 0;
left: 0;
overflow: hidden;
}
.star-rating.s0:after {
width: 0%;
}
.star-rating.s1:after {
width: 10%;
}
.star-rating.s2:after {
width: 20%;
}
.star-rating.s3:after {
width: 30%;
}
.star-rating.s4:after {
width: 40%;
}
.star-rating.s5:after {
width: 50%;
}
.star-rating.s6:after {
width: 60%;
}
.star-rating.s7:after {
width: 70%;
}
.star-rating.s8:after {
width: 80%;
}
.star-rating.s9:after {
width: 90%;
}
.star-rating.s10:after {
width: 100%;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<span class="star-rating s7"></span>
This is a bug that the M$ browser has when dealing with pseudo elements. The workaround is:
.star-rating {overflow: hidden;}
Under a browser that is designed to comply to standards (i.e. real browsers such as Chrome and Firefox), just having .star-rating::after is good enough. Unfortunately, M$ browsers are garbage.
Check the styles in the developer tools and you'll see that all of the pseudo elements ::before and ::after are crossed out. This is one of the many bugs IE is infested with. Here are the symptoms:
The developer tools have all of the pseudo element styles crossed out
Although the styles look like they are disabled according to the developer tool, the majority of them are not.
If there is a behavior that is unique to only IE and/or Edge, then the bug's secondary side effect has manifested. There are style properties that are ignored when applied to a pseudo element when the parent element doesn't implicitly have the property itself.
Issue: In OP's specific case, the pseudo element: .star-rating::after property: overflow: hidden was ignored because IE requires the parent: .star-rating to have it as well.
Workaround: Apply overflow: hidden to .star-rating
Demo (tested in Chrome, Firefox, and IE)
.star-rating {
display: inline-block;
position: relative;
line-height: 1;
overflow: hidden;
}
.star-rating:before,
.star-rating:after {
content: "\f005\f005\f005\f005\f005";
display: block;
font-family: "FontAwesome";
font-size: 25px;
color: #ccc;
}
.star-rating:after {
color: gold;
position: absolute;
top: 0;
left: 0;
overflow: hidden;
}
.star-rating.s0:after {
width: 0%;
}
.star-rating.s1:after {
width: 10%;
}
.star-rating.s2:after {
width: 20%;
}
.star-rating.s3:after {
width: 30%;
}
.star-rating.s4:after {
width: 40%;
}
.star-rating.s5:after {
width: 50%;
}
.star-rating.s6:after {
width: 60%;
}
.star-rating.s7:after {
width: 70%;
}
.star-rating.s8:after {
width: 80%;
}
.star-rating.s9:after {
width: 90%;
}
.star-rating.s10:after {
width: 100%;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<span class="star-rating s7"></span>
Add white-space:nowrap to the .star-rating::before, .star-rating::after rule.
.star-rating {
display: inline-block;
position: relative;
line-height: 1;
}
.star-rating:before,
.star-rating:after {
content: "\f005\f005\f005\f005\f005";
display: block;
font-family: "FontAwesome";
font-size: 25px;
color: #ccc;
white-space:nowrap;
}
.star-rating:after {
color: gold;
position: absolute;
top: 0;
left: 0;
overflow: hidden;
}
.star-rating.s0:after {
width: 0%;
}
.star-rating.s1:after {
width: 10%;
}
.star-rating.s2:after {
width: 20%;
}
.star-rating.s3:after {
width: 30%;
}
.star-rating.s4:after {
width: 40%;
}
.star-rating.s5:after {
width: 50%;
}
.star-rating.s6:after {
width: 60%;
}
.star-rating.s7:after {
width: 70%;
}
.star-rating.s8:after {
width: 80%;
}
.star-rating.s9:after {
width: 90%;
}
.star-rating.s10:after {
width: 100%;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<span class="star-rating s7"></span>
I have a simple website that I am making for my music over at (secure tunnel) http://79a6b00f.ngrok.io using media queries and everything, with the meta tag (<meta name="viewport" content="width=device-width, initial-scale=1">)in the header on index.html.
I have had someone test it on their phone, and the website zooms out, instead of maintaining scale and showing a hamburger menu. Here's my query code:
#media all and (max-width: 2600px) {
.w-ctrl {
width: 950px;
margin: auto;
}
}
#media all and (max-width: 966px) {
.w-ctrl {
width: 100%;
margin: auto;
}
.sub-header {
width: 100%;
background: #37474F;
height: 500px
}
.lnd-con .pic {
height: 500px;
background-attachment: scroll;
}
.lnd-con .label-con {
top: -350px;
text-align: center;
}
.label-con .title {
font-size: 25px;
}
.label-con .subtitle {
font-size: 25px;
}
}
#media all and (max-width: 636px) {
.w-ctrl {
width: 100%;
margin: auto;
}
.nav-con-big {
display: none;
}
.nav-con-small {
display: block;
}
.lnd-con .pic {
height: 300px;
}
.title-con {
display: none;
}
.lnd-con {
margin-top: 0px;
}
.lnd-con .label-con {
position: static;
text-align: left;
background: transparent;
padding-top: 5px;
padding-bottom: 8px;
letter-spacing: 0px;
}
.label-con .title {
font-size: 20px;
}
.label-con .subtitle {
font-size: 18px;
}
.sub-header {
width: 100%;
height: 400px
}
}
I could not fit my website into a js-fiddle, so I created a tunnel instead. I hope it's okay, as far as I am aware I'm not breaking any rules.
I see this declaration at the top of your global.css:
#viewport {
zoom: 1.0;
width: extend-to-zoom;
}
take it out or set width: device-width;:
#viewport {
width: device-width;
}
also, support for css device adaptation is pretty poor (http://caniuse.com/#search=%40viewport), possibly it is somehow conflicting with the meta tag implementation
You have to show us what meta viewport tag your using for #1. There are many.
But also; if you'd like to see the changes within your browser you can always write the media queries as between 2 widths as below:
/* SAMPLE No greater than 900px, no less than 400px */
#media (max-width:900px) and (min-width:400px) {
.CurrentlyOnVacation {
display:none;
}
}
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;">
Having trouble with my responsive layout. My twelve columns blocks are not on one row the last two float under it but should be all in one line.
Each row will be having its own column blocks.
You can get full code view of what I mean at my codepen snippet.
http://codepen.io/riwakawebsitedesigns/pen/zbmLE
.container {
display: block;
width: 94%;
max-width: 1280px;
margin: 2% auto 0 auto;
}
.row {
display: block;
}
.row:after {
content: "";
display: table;
clear: both;
}
.column {
background: #e5e5e5;
min-height: 40px;
text-align: center;
float: left;
margin-right: 20px;
}
.block-1 {
width: 8.33333333%;
}
.block-2 {
width: 16.66666667%;
}
.block-3 {
width: 25%;
}
.block-4 {
width: 33.33333333%;
}
.block-5 {
width: 41.66666667%;
}
.block-6 {
width: 50%;
}
.block-7 {
width: 58.33333333%;
}
.block-8 {
width: 66.66666667%;
}
.block-9 {
width: 75%;
}
.block-10 {
width: 83.33333333%;
}
.block-11 {
width: 91.66666667%;
}
.block-12 {
width: 100%;
}
.last, .omega, .end{
margin: 0;
}
Remove the margin on the columns:
.column {
background: #e5e5e5;
min-height: 40px;
text-align: center;
float: left;
margin-right: 20px; <!-- remove -->
}
Instead of the reaching 100% width the margin is causing less width for them due to the 20px x 12. So your getting 100% + 240px, this is causing the last 2 to move below.
DEMO HERE
Ruddy is right, you are not considering the gutter between columns. Do his way or...
SIMPLE SOLUTION:
Try to subtract 2% from each block class, worked here.
FANCY SOLUTION:
If you use LESS you can work with variables, so you could do something like this:
/*LESS FILE*/
#gutter: "20px";
.block1 {
width: (8.333% - #gutter);
}
Hope it helps.