Flexbox not working in Safari and IOS - ios

I have made a responsive flexbox grid. It works in Chrome, but not in Safari and IOS. I must be missing something. Can anyone tell me what I'm doing wrong?
codepen
section {
max-width: 1280px;
display: block;
margin: 0 auto;
}
section:not(.grid) {
.wrapper {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-box-pack: start;
-ms-flex-pack: start;
justify-content: flex-start;
}
.box {
-webkit-box-flex: 1;
-webkit-flex: 1 1 12em;
-ms-flex: 1 1 12em;
flex: 1 1 12em;
}
}
.wrapper {
display: -ms-grid;
display: grid;
-ms-grid-columns: (minmax(12em, 1fr))[auto-fill];
grid-template-columns: repeat(auto-fill, minmax(12em, 1fr));
}
.box {
padding-right: 1em;
}
.box:last-of-type {
padding-right: 0;
}

Remove this enclosing element from your SCSS, but keep everything inside it:
section:not(.grid) {}
it means those flex styles will NOT be applied.
section {
max-width: 1280px;
display: block;
margin: 0 auto;
border: 1px dashed red;
}
.wrapper {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-box-pack: start;
-ms-flex-pack: start;
justify-content: flex-start;
}
.box {
-webkit-box-flex: 1;
-webkit-flex: 1 1 12em;
-ms-flex: 1 1 12em;
flex: 1 1 12em;
border: 1px dashed blue;
}
.wrapper {
display: -ms-grid;
display: grid;
-ms-grid-columns: (minmax(12em, 1fr))[auto-fill];
grid-template-columns: repeat(auto-fill, minmax(12em, 1fr));
}
.box {
padding-right: 1em;
}
.box:last-of-type {
padding-right: 0;
}
<section class="grid">
<h4>All projects</h4>
<div class="wrapper">
<div class="box">
<h5>Project 1<br>
<span>Category</span>
</h5>
</div>
<div class="box">
<h5>Project 2<br>
<span>Category</span>
</h5>
</div>
<div class="box">
<h5>Project 3<br>
<span>Category</span>
</h5>
</div>
<div class="box">
<h5>Project 4<br>
<span>Category</span>
</h5>
</div>
<div class="box">
<h5>Project 5<br>
<span>Category</span>
</h5>
</div>
<div class="box">
<h5>Project 6<br>
<span>Category</span>
</h5>
</div>
</div>
</section>

Related

MVC sidebar responsive issue

I'm using a template found https://bootstrapious.com/p/bootstrap-sidebar (it's the 2nd sidebar option). I have it integrated into a stock MVC5 application and everything works except for whatever is in RenderBody(), it's not responsive to when the sidebar is toggled open/closed. It is responsive when I resize the page, and the sidebar responds appropriately too, but I don't want the sidebar to overlay the contents on RenderBody(). How would I go about fixing that? Thank you in advanced!
_Layout.cshtml
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
#Styles.Render("~/Content/css")
#Scripts.Render("~/bundles/modernizr")
<!-- Scrollbar Custom CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.min.css">
</head>
<body>
<div class="wrapper">
<!-- Sidebar Holder -->
<nav id="sidebar">
<div class="sidebar-header">
<h3>Bootstrap Sidebar</h3>
</div>
<ul class="list-unstyled components">
<p>Dummy Heading</p>
<li class="active">
Home
<ul class="collapse list-unstyled" id="homeSubmenu">
<li>Home 1</li>
<li>Home 2</li>
<li>Home 3</li>
</ul>
</li>
<li>
About
Pages
<ul class="collapse list-unstyled" id="pageSubmenu">
<li>Page 1</li>
<li>Page 2</li>
<li>Page 3</li>
</ul>
</li>
<li>
Portfolio
</li>
<li>
Contact
</li>
</ul>
</nav>
<!-- Page Content Holder -->
<div id="content">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" id="sidebarCollapse" class="btn btn-info navbar-btn">
<i class="glyphicon glyphicon-align-left"></i>
<span>Toggle Sidebar</span>
</button>
</div>
<!--
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>Page</li>
<li>Page</li>
<li>Page</li>
<li>Page</li>
</ul>
</div>-->
</div>
</nav>
</div>
</div>
<div class="container body-content">
#RenderBody()
<hr />
<footer>
<p>© #DateTime.Now.Year - My ASP.NET Application</p>
</footer>
</div>
#Scripts.Render("~/bundles/jquery")
#Scripts.Render("~/bundles/bootstrap")
#RenderSection("scripts", required: false)
<!-- jQuery Custom Scroller CDN -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.concat.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#sidebar").mCustomScrollbar({
theme: "minimal"
});
$('#sidebarCollapse').on('click', function () {
$('#sidebar, #content').toggleClass('active');
$('.collapse.in').toggleClass('in');
$('a[aria-expanded=true]').attr('aria-expanded', 'false');
});
});
</script>
</body>
</html>
Site.css
#import "https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700";
body {
font-family: 'Poppins', sans-serif;
background: #fafafa;
}
p {
font-family: 'Poppins', sans-serif;
font-size: 1.1em;
font-weight: 300;
line-height: 1.7em;
color: #999;
}
a, a:hover, a:focus {
color: inherit;
text-decoration: none;
transition: all 0.3s;
}
.navbar {
padding: 15px 10px;
background: #fff;
border: none;
border-radius: 0;
margin-bottom: 40px;
box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
}
.navbar-btn {
box-shadow: none;
outline: none !important;
border: none;
}
.line {
width: 100%;
height: 1px;
border-bottom: 1px dashed #ddd;
margin: 40px 0;
}
/* ---------------------------------------------------
SIDEBAR STYLE
----------------------------------------------------- */
#sidebar {
width: 250px;
position: fixed;
top: 0;
left: 0;
height: 100vh;
z-index: 999;
background: #367fa9;
color: #fff;
transition: all 0.3s;
}
#sidebar.active {
margin-left: -250px;
}
#sidebar .sidebar-header {
padding: 20px;
background: #3c8dbc;
}
#sidebar ul.components {
padding: 20px 0;
border-bottom: 1px solid #47748b;
}
#sidebar ul p {
color: #fff;
padding: 10px;
}
#sidebar ul li a {
padding: 10px;
font-size: 1.1em;
display: block;
}
#sidebar ul li a:hover {
color: #367fa9;
background: #fff;
}
#sidebar ul li.active > a, a[aria-expanded="true"] {
color: #fff;
background: #3c8dbc;
}
a[data-toggle="collapse"] {
position: relative;
}
a[aria-expanded="false"]::before, a[aria-expanded="true"]::before {
content: '\e259';
display: block;
position: absolute;
right: 20px;
font-family: 'Glyphicons Halflings';
font-size: 0.6em;
}
a[aria-expanded="true"]::before {
content: '\e260';
}
ul ul a {
font-size: 0.9em !important;
padding-left: 30px !important;
background: #3c8dbc;
}
ul.CTAs {
padding: 20px;
}
ul.CTAs a {
text-align: center;
font-size: 0.9em !important;
display: block;
border-radius: 5px;
margin-bottom: 5px;
}
/* ---------------------------------------------------
CONTENT STYLE
----------------------------------------------------- */
#content {
width: calc(100% - 250px);
padding: 40px;
min-height: 100vh;
transition: all 0.3s;
position: absolute;
top: 0;
right: 0;
}
#content.active {
width: 100%;
}
/* ---------------------------------------------------
MEDIAQUERIES
----------------------------------------------------- */
#media (max-width: 768px) {
#sidebar {
margin-left: -250px;
}
#sidebar.active {
margin-left: 0;
}
#content {
width: 100%;
}
#content.active {
width: calc(100% - 250px);
}
#sidebarCollapse span {
display: none;
}
}

Owl carousel and parallax backgrounds

I have to use parallax.js to background images in owl carousel. For example I wanna use http://pixelcog.github.io/parallax.js/ with https://owlcarousel2.github.io/OwlCarousel2/docs/started-welcome.html
How can I do it?
pen: https://codepen.io/naaatasha/pen/gRdoej
<div class="owl-carousel slider">
<div class="item slide-wrapper parallax-window" data-parallax="scroll" data-image-src="http://trawnik.nazwa.pl/TrawnikProducent2016/wp-content/uploads/slide-strong-1.jpg">
<div class="container">
<div class="box">
<h2 class="h2 wow fadeIn text-right">co tam</h2>
<span class="subtitle wow fadeIn">ihsisdijbvjd</span>
</div>
</div>
</div>
<div class="item slide-wrapper parallax-window" data-parallax="scroll" data-image-src="http://www.focus.pl/upload/galleries/19/trawa-19061_l.jpg">
<div class="container">
<div class="box">
<h2 class="h2">lorem ipsum</h2>
<span class="subtitle">asdsk jbsjfd</span>
</div>
</div>
</div>
</div>
.slider {
position: relative;
display: table;
}
.box {
display: table-cell;
vertical-align: middle;
width: 1%;
}
.slide-wrapper {
height: 800px;
width: 100%;
background-color: #333;
backround-size: cover;
}
.h2 {
font-size: 40px;
font-weight: 500;
margin: 0;
text-transform: uppercase;
}
.subtitle {
display: block;
font-family: 'latolight', sans-serif;
font-size: 30px;
text-transform: uppercase;
}
.parallax-window {
min-height: 400px;
background: transparent !important;
}
jQuery(document).ready(function() {
jQuery(".slider").owlCarousel({
items: 1,
loop: true,
nav: false,
dots: false,
autoplay: true,
autoplayTimeout: 4000,
animateIn: 'fadeIn',
//onChange : callback
});
// function callback(event) {
// jQuery('.parallax-window').parallax();
// }
});

Button with display: flex does not work in Safari. Causing size and alignment issues

I'm having some problem with display: flex in both Safari and iOS Safari.
Safari has alignment issues and iOS Safari has both alignment and size issues. Is this expected or a valid bug in Safari?
Edit: Also, height in percentage on the child SVG inside the Button does not work either. This works in all other browsers.
I mane another more advanced example with SVG elements, and I added an anchor to compare to the button. More advanced example here
My simple example
HTML:
<div class="flex">
<div class="col col-1">
<button class="sub-col">
<span class="span"></span>
</button>
<div class="sub-col">2</div>
<div class="sub-col">3</div>
</div>
<div class="col col-2"></div>
<div class="col col-3"></div>
</div>
CSS:
.flex {
display: flex;
flex-direction: column;
height: 80vh;
background: #666666;
position: fixed;
width: 100%;
}
.col {
display: inherit;
flex: 1 1 auto;
background: #ccffcc;
}
.col-1 {
flex: 0 0 10vh;
background: #ffcccc;
}
.col-3 {
flex: 0 0 10vh;
background: #ccccff;
}
.sub-col {
display: inherit;
flex: 0 0 25%;
justify-content: center;
align-items: center;
}
.span {
width: 10px;
height: 10px;
background: #ffaaaa;
}
Screenshots:
This is what it should look like, and does in Chrome, FF and Edge (Haven't tested IE)
This is what it looks like in Safari
And this is iOS Safari
You can't set display flex to button and fieldset elements. chk below link. Wrap your element with div or span tags
https://github.com/philipwalton/flexbugs#9-some-html-elements-cant-be-flex-containers
The button element, and a couple other elements for that matter, cannot be flex containers in some browsers. Safari is one of them.
You can try a simple solution though, if you like. The idea is, you wrap your .span inside .span-wrapper. Then you let .span-wrapper be your flex container.
Like that:
HTML:
<div class="flex">
<div class="col col-1">
<button class="sub-col">
<span class="span-wrapper">
<span class="span"></span>
</span>
</button>
<div class="sub-col">2</div>
<div class="sub-col">3</div>
</div>
<div class="col col-2"></div>
<div class="col col-3"></div>
</div>
CSS:
.flex {
display: flex;
flex-direction: column;
height: 80vh;
background: #666666;
position: fixed;
width: 100%;
}
.col {
display: inherit;
flex: 1 1 auto;
background: #ccffcc;
}
.col-1 {
flex: 0 0 10vh;
background: #ffcccc;
}
.col-3 {
flex: 0 0 10vh;
background: #ccccff;
}
.sub-col {
display: inherit;
flex: 0 0 25%;
justify-content: center;
align-items: center;
}
.span {
width: 10px;
height: 10px;
background: #ffaaaa;
}
.span-wrapper {
display: flex;
flex-basis: 100%;
justify-content: center;
align-items: center;
}

CSS3 - Flex wrap not working on IOS 10.1.1 Safari & Chrome

I'm trying to use flex wrap and min-width: 50% to dynamic grid layout where single cells occupy all width. The problem is that it's not working correctly in iOS 10.1.1 (iPhone 5c) Safari and Chrome - the display is not grid-like, but a horizontal layout. In desktop Chrome (Ubuntu) and Android Chrome is working fine.
Jsfiddle demo: https://jsfiddle.net/9dscc1Lq/
Code:
<style>
body {
width: 300px;
}
.tabs {
width: 100%;
display: flex;
display: -webkit-flex;
flex-wrap: wrap;
-webkit-flex-wrap: wrap;
flex: 0 0 auto;
-webkit-flex: 0 0 auto;
box-sizing: border-box;
flex-flow: row wrap;
-webkit-flex-flow: row wrap;
}
.tab {
border: 1px solid #3A3A3A;
color: #929292;
min-width: 50%;
box-sizing: border-box;
flex: 1 1 0;
-webkit-flex: 1 1 0;
text-align: center;
}
</style>
<div class="tabs">
<div class="gwt-HTML tab">1</div>
<div class="gwt-HTML tab">2</div>
<div class="gwt-HTML tab">3</div>
<div class="gwt-HTML tab">4</div>
<div class="gwt-HTML tab">5</div>
</div>
Expected layout (correct):
iOS behavior (incorrect):
Please advise!
min-width doesn't work as intended on iOS, use flex-basis like this flex: 1 1 50%;
Src: https://bugs.webkit.org/show_bug.cgi?id=136041
Also, when using prefixed properties, you should always put them before the unprefixed version.
.tabs {
width: 100%;
display: -webkit-flex;
display: flex;
-webkit-flex-wrap: wrap;
flex-wrap: wrap;
box-sizing: border-box;
}
.tab {
border: 1px solid #3A3A3A;
color: #929292;
box-sizing: border-box;
-webkit-flex: 1 1 50%;
flex: 1 1 50%;
text-align: center;
}
<div class="tabs">
<div class="gwt-HTML tab">1</div>
<div class="gwt-HTML tab">2</div>
<div class="gwt-HTML tab">3</div>
<div class="gwt-HTML tab">4</div>
<div class="gwt-HTML tab">5</div>
</div>

Unable to display right tick mark in checkbox in tablets and iPad

I have following code, it displays check mark ticked on desktop. But doesn't work on iPad and tablets. Functionality is working but right mark is not shown.
<div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 borderAtRight"
<!-- Dropdown and Menu -->
<div class="btn-group topFilterCtrl filterDropdn" dropdown
dropdown-append-to-body
id="ddlStatus">
<div id="btn-append-to-body" type="button"
class="btn btn-primary panelTextFont14 noBorder"
dropdown-toggle>
Status<span class="caret caretSpan"></span>
</div>
<ul class="dropdown-menu dropDownLabel" role="menu"
aria-labelledby="btn-append-to-body"
ng-show="!vm.showthis">
<div class="customScroll">
<li role="menuitem" class="changeColorOnHover"
ng-repeat="optionThis in vm.List track by $index"
ng-show="list.value != null">
<a href="#">
<div class="checkbox" id="{}index}"
ng-show="this.value != null"
ng-click="vm.applyFilterForResultCount()"
ng-change="vm.getCount(this)"
ng-model="this.flag">
<label>
<input type="checkbox"
ng-click="vm.clickStatusCheckBox(this);$event.stopPropagation();"
ng-show="this.value != null"/>
{{this.value}}
</label>
</div>
</a>
</li>
</div>
<!--Clear div-->
<li role="menuitem" class="btn btn-default buttonli"
ng-click="vm.clearAll()">
<a href="#">
<p>
<span class="clearAllBtn">Clear</span>
<span class="dropDownBtnItem"> – All </span>
</p>
</a>
</li>
</ul>
</div>
</div>
.topFilterCtrl{
text-align: left;
vertical-align: middle;
padding-top: 8%;
padding-bottom: 0%;
border-radius: 0;
margin-top: 0%;
box-shadow: none;
outline: none;
border:none;
width:100%;
}
portrait:
div.borderAtRight .filterDropdn{
padding-top:14%;
}
.filterDropdn{
padding-top: 10%;
height: 50px;
max-height: 50px;
overflow: hidden;
}
.noBorder{
text-align: left;
width:#full-width;
box-shadow: none;
outline: none;
min-width: 80%;
padding: 0;
height: auto;
min-height: 36px;
border-top-color: none;
border-top-style: none;
border-top-width: none;
border-right-color: none;
border-right-style: none;
border-right-width: none;
border-bottom-color: none;
border-bottom-style: none;
border-bottom-width: none;
border-left-color: none;
border-left-style: none;
border-left-width: none;
}
.dropDownLabel{
margin:0 0 0 -16px;
}
.customScroll{
height: auto;
overflow-x: hidden;
max-height:360px;
}
.customScroll>li>a,
.customScroll>li>a:hover,
.customScroll>li>a:active,
.customScroll>li>a:focus {
display: block;
padding: 1px 22px;
clear: both;
white-space: nowrap;
text-decoration : none;
}
.buttonli {
border-left: 0;
border-right: 0;
border-radius: 0;
margin: 2px 0px 2px 0px;
width: 100%;
background-color:#E4EAEF;
}
li.buttonli > a > p{
margin-bottom:0;
}
input[type="checkbox"]{
-webkit-appearance: checkbox;
}
I found this: https://github.com/angular-ui/bootstrap/issues/2017
But not sure how do I implement it, where should I really include this directive in my code as I am very new to AJS?
The checkbox may not display correct because the input element is nested inside the label element (even though it may be allowed, it confuses the purposes of the input and the label).
If the issue is about the checkbox not being checked by default, you might need to check out the ng-checked="expression" syntax for Angular.

Resources