Materialize css - side-nav - dropdown - wrong links on iOS Safari - css

I have a materialize css web app with a side-nav.
In the side-nav there are two "sub-menus" as dropdown-content.
It works perfectly fine on all browsers except Safari/iOS, where a click in the sub-menu will open another link than the one clicked. Looks a little random, but maybe it selects the link below in the sidenav menu.
The really weird thing is, that it works on iPhone 5.
It also works on iPhone 7 but here comes the weird part: only if you make long-click (tap and hold) on the menu item, then it displays a preview of the link and you can select open. In that case it is the correct menu item from the drop-down content that is displayed.
I am very puzzled and is excited to see if anyone can see through this...
I have tried a few different css options besided the standard materialize css, they are included in the code.
(Version 1.0.0 of materialize)
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<style>
header, main, footer {
padding-left: 300px;
}
.hide-on-menu-out {
display: none;
}
/*https://github.com/Dogfalo/materialize/issues/1123 */
.navbar-fixed nav {
position: fixed;
/* width is 100% minus the fixed left navbar (240px) */
width: -moz-calc(100% - 300px); /* Firefox */
width: -webkit-calc(100% - 300px); /* Chrome, Safari */
width: calc(100% - 300px); /* IE9+ and future browsers */
}
.dropdown-content a {
/*background-color:red;*/
position:relative;
z-index: 10000 !important;
}
#media only screen and (max-width : 992px) {
header, main, footer {
padding-left: 0;
}
.show-on-menu-out {
display: block;
}
.hide-on-menu-out {
display: block;
}
/* https://github.com/Dogfalo/materialize/issues/1123 */
.navbar-fixed nav {
width: 100%;
}
}
</style>
<asp:ContentPlaceHolder ID="header" runat="server"></asp:ContentPlaceHolder>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FormBody" runat="server">
<ul id="langdrops" class="dropdown-content">
<asp:Literal ID="litLangs" runat="server"></asp:Literal>
</ul>
<ul id="dropFriends" class="dropdown-content">
<li><i class="material-icons blue-text">map</i><%=Resources.KSLab.KS2020WithMenu_menuFriendRadar%></li>
<li><i class="material-icons blue-text">people</i><%=Resources.KSLab.KS2020WithMenu_menuFriends%></li>
<li><i class="material-icons blue-text">search</i><%=Resources.KSLab.KS2020WithMenu_menuSearchFriends%></li>
<li><i class="material-icons blue-text">clear_all</i><%=Resources.KSLab.KS2020WithMenu_menuFriendReq%></li>
</ul>
<ul id="dropMore" class="dropdown-content">
<li><i class="material-icons blue-text">flag</i><%=Resources.KSLab.KS2020WithMenu_menuMultitrack%></li>
<li><i class="material-icons blue-text">supervised_user_circle</i><%=Resources.KSLab.KS2020WithMenu_menuGroups%></li>
<li><i class="material-icons blue-text">star</i><%=Resources.KSLab.KS2020WithMenu_menuChallenges%></li>
<li><i class="material-icons blue-text">timeline</i><%=Resources.KSLab.KS2020WithMenu_menuRouteMeas%></li>
</ul>
<header>
<div class="navbar-fixed">
<nav>
<div class="nav-wrapper blue">
<ul id="nav-mobile" class="left">
<!-- show-on-large show-on-extra-large -->
<li><i class="material-icons">menu</i></li>
<%--<li><i class="material-icons">language</i></li>--%>
</ul>
<span data-target="slide-out" style="cursor: pointer" id="navbarBoatName" class="sidenav-trigger center hide-on-menu-out"></span>
<a href="/" style="margin-top: 4px; margin-right: 5px;" class="right brand-logo">
<img style="height: 50px;" src="/Public/Images/LogoWhite150x57.png" /></a>
</div>
</nav>
</div>
<ul id="slide-out" class="sidenav sidenav-fixed blue">
<li>
<div class="user-view">
<div class="background">
<img src="/Public/Images/ocean.jpg">
</div>
<div id="notifyAlert" class="notifyAlert">
<a href="/notifications" class="btn-floating btn-large waves-effect pulse waves-light alert-red">
<i class="fa large fa-bell"></i></a>
</div>
<img id="menuBoatImage" class="circle" src="/Public/Images/noimage.png">
<div style="clear: both"></div>
<div id="menuBoatName" class="white-text name"></div>
<div id="menuBoatType" class="white-text email"> </div>
</div>
</li>
<li><i class="material-icons white-text">home</i><%=Resources.KSLab.KS2020WithMenu_menuHome%></li>
<li><i class="material-icons white-text">map</i><%=Resources.KSLab.KS2020WithMenu_menuMyLog%></li>
<li><i class="material-icons white-text">share</i><%=Resources.KSLab.KS2020WithMenu_menuShare%></li>
<li><i class="material-icons white-text">people</i><%=Resources.KSLab.KS2020WithMenu_menuSubFriends%></li>
<li><i class="material-icons white-text">filter_9_plus</i><%=Resources.KSLab.KS2020WithMenu_menuMore%></li>
<li><i class="material-icons white-text">settings</i><%=Resources.KSLab.KS2020WithMenu_menuMyProfile%></li>
<li>
<div class="divider"></div>
</li>
<li><i class="material-icons white-text">language</i><%=Resources.KSLab.generalSelectLanguage%></li>
<li><i class="material-icons white-text">help_outline</i><%=Resources.KSLab.KS2020WithMenu_menuHelp%></li>
<li><i class="material-icons white-text">info</i><%=Resources.KSLab.KS2020WithMenu_menuAbout%></li>
<li><i class="material-icons white-text">close</i><%=Resources.KSLab.KS2020WithMenu_menuLogOff%></li>
</ul>
</header>
<main>
<asp:ContentPlaceHolder ID="BelowMenu" runat="server"></asp:ContentPlaceHolder>
</main>
<asp:ContentPlaceHolder ID="OutsideMain" runat="server"></asp:ContentPlaceHolder>
</asp:Content>

I added inDuration, outDuration and closeOnClick options to fix this. Here are all my options for this particular example.
var dropdownOptionsMobile = {
coverTrigger: false,
inDuration: 0,
outDuration: 0,
hover: false,
closeOnClick: false
}
var elems = document.querySelectorAll('.dropdown-trigger-mobile');
var instances = M.Dropdown.init(elems, dropdownOptionsMobile);

It is a known issue, here you can read about it and the solution:
Select element is misbehaving on iOS
Shortly, the dropdown issue itself is caused by the animation. You can use the materialize-css-helper package to keep the animation and fix the issue, or just remove the animation through css:
.dropdown-content {
transform: none !important;
}

I have the same problem and I've founded out that it is a bug. They've already fixed it, but didn't released :(
Look here, there are some tips, like set closeOnClick to false

Related

Scrolling navbar (navbar-fixed) only on Desktop

I want to make a navbar that scrolls with the site.
Now, if I just wanted that, I'd just add .navbar-fixed and call it a day.
However, I want that only on desktop.
On mobile, I want it to stay at the top.
Is there a way I can do that?
I've looked into jQuery for this, but everybody says I should use media queries for this (to which I do agree).
The code for my navbar is very simple with no additional CSS.:
<div class="navbar">
<nav>
<div class="nav-wrapper container">
<a href="#" class="brand-img img-responsive" wp-home-url wp-home-url-set="href" wp-home-url-scheme="relative">
<img src="https://www.finlaydag33k.nl/wp-content/uploads/2016/08/logo-FDG-300-01-300x300.png">
</a>
<ul id="nav-mobile" class="right">
<li>
<i class="material-icons">menu</i>
</li>
</ul>
</div>
</nav>
</div>
so tl;dr:
On desktop: make it like it's having .navbar-fixed.
On phone: make like it doesn't have .navbar-fixed.
You have 2 solutions for this .
1. Using CSS media queries .
1.a. First make your navbar fixed using position:fixed , and then under
767px ( which is mobile ) change it to position:relative or
absolute depending on what you want.
See snippet below or > jsFiddle
.content {
height:200px;
width:100%;
background:red;
}
.navbar {
position:fixed;
width:100%;
top:0;
left:0;
}
#media only screen and (max-width: 767px) {
.navbar {
position:relative;
}
}
<div class="navbar">
<nav>
<div class="nav-wrapper container">
<a href="#" class="brand-img img-responsive" wp-home-url wp-home-url-set="href" wp-home-url-scheme="relative">
<img src="https://www.finlaydag33k.nl/wp-content/uploads/2016/08/logo-FDG-300-01-300x300.png">
</a>
<ul id="nav-mobile" class="right">
<li>
<i class="material-icons">menu</i>
</li>
</ul>
</div>
</nav>
</div>
<div class="content">
</div>
1.b. You can also make a media query for desktop only.
See snippet below or > jsFiddle
.content {
height: 200px;
width: 100%;
background: red;
}
#media only screen and (min-width: 767px) {
.navbar {
position: fixed;
width: 100%;
top: 0;
left: 0;
}
}
<div class="navbar">
<nav>
<div class="nav-wrapper container">
<a href="#" class="brand-img img-responsive" wp-home-url wp-home-url-set="href" wp-home-url-scheme="relative">
<img src="https://www.finlaydag33k.nl/wp-content/uploads/2016/08/logo-FDG-300-01-300x300.png">
</a>
<ul id="nav-mobile" class="right">
<li>
<i class="material-icons">menu</i>
</li>
</ul>
</div>
</nav>
</div>
<div class="content">
</div>
2. Use jQuery for this and add class navbar-fixed in html and remove it when on mobile. See below or > jsFiddle
var wWidth = $(window).width()
if ( wWidth < 767) {
$(".navbar").removeClass("navbar-fixed-top")
}
.content {
height: 200px;
width: 100%;
background: red;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<div class="navbar navbar-fixed-top">
<nav>
<div class="nav-wrapper container">
<a href="#" class="brand-img img-responsive" wp-home-url wp-home-url-set="href" wp-home-url-scheme="relative">
<img src="https://www.finlaydag33k.nl/wp-content/uploads/2016/08/logo-FDG-300-01-300x300.png">
</a>
<ul id="nav-mobile" class="right">
<li>
<i class="material-icons">menu</i>
</li>
</ul>
</div>
</nav>
</div>
<div class="content">
</div>
using #Mihai T's (I don't know how to tag people here on SO) post as inspiration and a bit of a guide, I managed to get a working solution:
#media only screen and (max-width: 767px)
{
.navbar-fixed nav
{
position: relative;
}
.navbar-fixed
{
position: relative;
height: 56px;
z-index: 998;
}
}
Thanks for the help :D

Bootstrap 4 menu positioning with image

I'm using this template:
http://bootstrap4.guide/
And I want to modify menu a bit, instead of having blue Bootstrap 4 text, I'd like to have a image there. It's looking all fine until I look at mobile view.
I'm expecting to have my image in the same place as the text:
However my image happens to appear under hamburger menu:
This is what I have at the moment:
<nav id='topNav' className='navbar navbar-default navbar-fixed-top'>
<div className='container'>
<button className='navbar-toggler hidden-md-up pull-right' type='button' data-toggle='collapse' data-target='#collapsingNavbar'>
☰
</button>
<a className='navbar-brand page-scroll' href='#first'><img src='logo.png'/></a>
<div className='collapse navbar-toggleable-sm' id='collapsingNavbar'>
<ul className='nav navbar-nav'>
<li className='nav-item'>
<a className='nav-link page-scroll' href='#one'>Cards</a>
</li>
<li className='nav-item'>
<a className='nav-link page-scroll' href='#two'>Flexbox</a>
</li>
<li className='nav-item'>
<a className='nav-link page-scroll' href='#three'>5 Tiers</a>
</li>
<li className='nav-item'>
<a className='nav-link page-scroll' href='#four'>More</a>
</li>
</ul>
<ul className='nav navbar-nav pull-xs-right'>
<li className='nav-item'>
<a className='nav-link page-scroll' data-toggle='modal' title='A free Bootstrap theme' href='#aboutModal'>About</a>
</li>
</ul>
</div>
</div>
</nav>
I've just replaced Bootstrap 4 with this img tag: <img src='logo.png'/>. I'm quite new to bootstrap, if someone would help me to figure out how to sort this out, that'd be great.
I would suggest to divide the the hamburger and the logo in two equal parts by using bootstrap classes for small devices.(col-xs-6)
<div class="col-xs-12">
<div class="col-xs-6">
<button className='navbar-toggler hidden-md-up' type='button' data-toggle='collapse' data-target='#collapsingNavbar'>
☰
</button>
</div>
<div class="col-xs-6">
<a className='navbar-brand page-scroll' href='#first'><img src='logo.png'/></a>
</div>
</div>
Adjust the navbar-brand class as needed for your logo image..
/* responsive nav */
#media(max-width:48em) {
.navbar-default .navbar-nav>.nav-item {
float: none;
margin-left: .1rem;
}
.navbar-default .navbar-nav {
float:none !important;
}
.navbar-default .navbar-brand {
float:none;
}
.navbar-default .navbar-brand img {
display:inline;
}
}
http://codeply.com/go/7HJgyK6nxQ

How can I make an div span the entire width of my screen

Im making a little project and I just cant seem to get my css right... I need my header div(I used a regular div instead of an actual header because I wanted everything in the body). I want the blue header span my entire screen, but I just dont know how. I tried somethings with margin and padding but thats it.
Also I tried getting those buttons to the bottom of the Div, but just cant seem to get it right...
SCREENSHOT: http://prntscr.com/9slfw2
Description: See my website here
CSS:
body {
margin: 0px;
padding: 0px;
}
ul {
list-style-type: none;
}
.page-header{
background-color: #0094ff;
margin-top: 0px;
display: block
}
.panel, .list-group-item, .btn {
border-color: #0094ff;
}
#btnRegister {
margin-right: 10px;
vertical-align: bottom;
}
.input-group-addon {
min-width: 40px;
}
legend.scheduler-border {
width:inherit;
padding:0 10px;
border-bottom:none;
}
HTML:
<!-- Carousel -->
<div id="homeCarousel" class="carousel slide">
<!-- Menu -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<!-- Items -->
<div class="carousel-inner">
<!-- Item 1 -->
<div class="item active">
<img class="c_img" src="~/Images/chevy.jpg" />
<div class="container">
<div class="carousel-caption">
<h1>Contact</h1>
<p style="background-color:#428bca;">Om gemakkelijk met Rent-a-Car contact op te nemen kunt u ook bellen!</p>
<p style="background-color:#428bca;">Tel: 0534891034, Adres: Vuurnatieweg 69420</p>
<p>
<a class="btn btn-lg btn-primary" href="~/Home/Contact" >Klik hier voor meer contact informatie!</a>
</p>
</div>
</div>
</div>
<!-- Item 2 -->
<div class="item">
<img class="c_img" src="~/Images/42-RT-76.jpg" />
<div class="container">
<div class="carousel-caption">
<h1>Changes to the Grid</h1>
<p style="background-color:#428bca;">Bootstrap 3 still features a 12-column grid, but many of the CSS class names have completely changed.</p>
<p style="background-color:#428bca;"><a class="btn btn-large btn-primary" href="#">Learn more</a></p>
</div>
</div>
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="icon-prev"></span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="icon-next"></span>
</a>
<div id="carouselButtons">
<button id="playButton" type="button" class="btn btn-default btn-xs">
<span class="glyphicon glyphicon-play"></span>
</button>
<button id="pauseButton" type="button" class="btn btn-default btn-xs">
<span class="glyphicon glyphicon-pause"></span>
</button>
</div>
</div>
<script type="text/javascript">
$(function () {
$('#homeCarousel').carousel({
interval:5000,
pause: "false"
});
$('#playButton').click(function () {
$('#homeCarousel').carousel('cycle');
});
$('#pauseButton').click(function () {
$('#homeCarousel').carousel('pause');
});
});
</script>
EDIT: HTML code and .. I am using Bootstrap, just so you know
The issue is that you're using Bootstrap, as indicated by the classes in your HTML and your clarifying edit. Bootstrap adds its own styling (obviously).
In particular, the .container class has padding, margins, and a fixed width that will prevent your layout from spanning the full screen. If you're doing things correctly, your .row <div> tag is in a container.
You have two options to fix this:
Use .container-fluid instead of .container**
This is the preferred option.
Override the default .container CSS rules
To override it, add rules for .container, like so:
.container {
padding-left: 0px;
padding-right: 0px;
margin-right: 0px;
margin-left: 0px;
width: 100%;
}
Here's a sample with Bootstrap's default CSS and one with the .container tweaks above.
Note: if you only want to override the one .container, just give it its own class or id and use an appropriate selector instead of .container in your CSS.
If you're using bootstrap, you can use .container-fluid instead of .container to get a full-width container.
Also, you seem to have mixed head (not in body) with header (in body).
More on the header tag: https://developer.mozilla.org/en/docs/Web/HTML/Element/header
Your code does span
Have a look here Demo

CSS media queries kicking in without specified width

I have one media query that kicks in without the width specified as a condition being met, even at 375px the media query takes over from the base CSS. The media query should take over from 660px. Here is my index.html page:
<!DOCTYPE html>
<html>
<head>
<title>Thames Accountants</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"> </script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="header-bg">
<header>
<button id="toggleButton" class="c-hamburger c-hamburger--rot">
<span>toggle menu</span>
</button>
<h1 class="logo">Thames Accountants</h1>
</header>
<p class="clear"></p>
<div class="ta-menu">
<nav>
<ul>
<li>Our Services</li>
<li>About Us</li>
<li>Blog</li>
<li>Contact Us</li>
</ul>
</nav>
</div> <!-- end ta-menu div -->
<div class="intro">
<p>Personalised Accounting</p>
<button type="button" class="btn btn-info ta-button">Get In Touch</button>
<div><span class="glyphicon glyphicon-chevron-down ta-icon"></span></div>
</div>
</div> <!-- end header-bg div -->
<div class="container">
<a name="services"></a>
<div id="services" class="services">
<h2 class="services-title">Accountancy Services</h2>
<p class="bullet-points">Annual Accounts <span class="glyphicon glyphicon-ok"></span></p>
<p class="bullet-points">Book-Keeping <span class="glyphicon glyphicon-ok"></p>
<p class="bullet-points">Company Secretarial <span class="glyphicon glyphicon-ok"></p>
<p class="bullet-points">Management Accounts <span class="glyphicon glyphicon-ok"></p>
</div>
<div class="services">
<h2 class="services-title">Added Value Services</h2>
<p class="bullet-points">Business Valuations <span class="glyphicon glyphicon-ok"></span></p>
<p class="bullet-points">Business Plans <span class="glyphicon glyphicon-ok"></p>
<p class="bullet-points">Management Systems <span class="glyphicon glyphicon-ok"></p>
<p class="bullet-points">Strategic Planning <span class="glyphicon glyphicon-ok"></p>
</div>
<div class="services">
<h2 class="services-title">Start-up Services</h2>
<p class="bullet-points">Ready made company <span class="glyphicon glyphicon-ok"></span></p>
<p class="bullet-points">Limited Liability Partnership <span class="glyphicon glyphicon-ok"></p>
<p class="bullet-points">PLC formation <span class="glyphicon glyphicon-ok"></p>
</div>
<div class="services">
<h2 class="services-title">Taxation Services</h2>
<p class="bullet-points">Contractors and IR35 <span class="glyphicon glyphicon-ok"></span></p>
<p class="bullet-points">Payroll, PAYE Returns and RTI <span class="glyphicon glyphicon-ok"></p>
<p class="bullet-points">VAT <span class="glyphicon glyphicon-ok"></p>
</div> <!-- end services div -->
</div> <!-- end container div -->
<div class="testimonials">
<h1 class="testimonial-title">Testimonials</h1>
<div class="ta-container">
<blockquote><p class="ta-review">Thames Accountants changes lives. Thanks for NOT being another overpaid below average bookkeeper but a true personalised accounting department for our company. - S. Johnson</p></blockquote>
<blockquote><p class="ta-review">Thames Accountants changes lives. Thanks for NOT being another overpaid below average bookkeeper but a true personalised accounting department for our company. - S. Johnson</p></blockquote>
<blockquote><p class="ta-review">Thames Accountants changes lives. Thanks for NOT being another overpaid below average bookkeeper but a true personalised accounting department for our company. - S. Johnson</p></blockquote>
</div>
</div>
<footer>
<div class="row ta-row">
<div class="col-md-4 ta-about">
<h4>About TA</h4>
<p>We are an experienced accounting agency based in South East, London, UK. We work closely with our clients and act for a broad range of business and personal clients.</p>
</div>
<div class="col-md-4 ta-social">
<h4>Social</h4>
<i class="fa fa-twitter"></i>
<i class="fa fa-facebook"></i>
<i class="fa fa-google-plus"></i>
<i class="fa fa-linkedin"></i>
</div>
<div class="col-md-4 ta-pages">
<h4>Menu</h4>
<ul>
<li>Our Services</li>
<li>About Us</li>
<li>Blog</li>
<li>Contact Us</li>
</ul>
</div>
</div> <!-- end row div -->
<div class="row ta-policies">
<div class="ta-center">
<div class="col-md-12">
<ul>
<li>Privacy Policy</li>
<li>Site terms</li>
</ul>
</div>
</div>
</div>
</footer>
<script type="text/javascript" src="js/app.js"></script>
</body>
</html>
And this is my CSS media query
Media queries for wider screens
**********************************/
#media (min-width: 660px) {
/*Parallax image for home page*/
.header-bg {
background: radial-gradient(#252625, transparent 150%), url('./img/tower-bridge.jpg');
background-attachment: fixed;
background-size: cover;
background-position: center center;
height: 600px;
width: 100%;
}
.logo {
font-size: 2em;
margin: 3% 0 0 5%;
text-align: left;
}
.intro p {
font-size: 1.5em;
margin-top: 10%;
}
.ta-button {
font-size: 0.6em;
padding: 5px;
border-radius: 5px;
}
.services-title {
font-size: 1.5em;
}
.ta-menu {
font-size: 1.5em;
}
.testimonial-title {
font-size: 1.75em;
}
blockquote {
font-size: 1.2em;
border-left: 3px solid #fff;
}
.services p {
font-size: 1em;
}
.ta-icon {
margin-top: 0;
}
.c-hamburger {
display: none;
}
.intro p {
margin-top: 0;
font-size: 1.2em;
border: none;
}
}/*End media query # 460 px*/

Webkit browsers renders multi-column layout contents wrong

I have a two-column layout in a bootstrap modal. There should be a bootstrap dropdown button as the content. Firefox renders it correctly but webkit based browsers fail to display the button correctly. The button does not get hover or click events since its position is rendered wrong.
The question is: Am I doing something wrong? And is there a way to avoid this problem?
The jsfiddle is here: http://jsfiddle.net/cenap/mtpj8god/4/
Full screen: http://jsfiddle.net/cenap/mtpj8god/4/embedded/result/
.multicolumn-container {
width: 250px;
height: 300px;
-webkit-column-count: 2;
/* Chrome, Safari, Opera */
-moz-column-count: 2;
/* Firefox */
column-count: 2;
-webkit-column-rule: 1px outset #CCC;
/* Chrome, Safari, Opera */
-moz-column-rule: 1px outset #CCC;
/* Firefox */
column-rule: 1px outset #CCC;
overflow: auto;
}
.box {
display: inline-block;
width: 100px;
min-height: 60px;
text-align: center;
border: 3px solid #666;
padding: 10px;
margin: 10px;
}
.err {
font-size: 8px;
color: red;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet" />
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<div class="container">
<div class="hero-unit">
<h1>Multicolumn in Bootstrap modal</h1>
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
Launch demo modal
</button>
</div>
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span>
</button>
<h4 class="modal-title">Modal title</h4>
<div class='btn-group'>
<button class='btn btn-default btn-sm dropdown-toggle' data-toggle='dropdown'><span class='caret'></span>
</button>
<ul class='dropdown-menu' role='menu' aria-labelledby='dLabel'>
<li><a href='#'>Some Action</a>
</li>
<li class='divider'></li>
<li><a href='#'>Some Other Action</a>
</li>
</ul>
</div>
<--- This works but the ones in columns below do not render correctly in webkit. </div>
<div class="modal-body">
<div class="multicolumn-container">
<div class="box">1
<div class='btn-group'>
<button class='btn btn-default btn-sm dropdown-toggle' data-toggle='dropdown'><span class='caret'></span>
</button>
<ul class='dropdown-menu' role='menu' aria-labelledby='dLabel'>
<li><a href='#'>Some Action</a>
</li>
<li class='divider'></li>
<li><a href='#'>Some Other Action</a>
</li>
</ul>
</div>
<span class="err">This is rendered wrong in webkit browsers</span>
</div>
<div class="box">2
<div class='btn-group'>
<button class='btn btn-default btn-sm dropdown-toggle' data-toggle='dropdown'><span class='caret'></span>
</button>
<ul class='dropdown-menu' role='menu' aria-labelledby='dLabel'>
<li><a href='#'>Some Action</a>
</li>
<li class='divider'></li>
<li><a href='#'>Some Other Action</a>
</li>
</ul>
</div>
<span class="err">This is rendered wrong in webkit browsers</span>
</div>
<div class="box">3</div>
<div class="box">4</div>
<div class="box">5</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
its working fine on Mac OSX webkit browsers - Chrome 37+ and Safari 7+, as on Firefox 30+. Please specify the browser version.
It seems like there is a bug in Webkit and columns have been disabled for printing by its developer (Dave Hyatt) because page breaking couldn't be implemented properly. So the WebKit implementation have CSS3 columns turned off, but Firefox renders them correctly. I’ve tried making columns work for printing in Chrome, but still getting better results from Firefox. Also there are some posts by Dave Hyatt and one of them stating that “Columns are using the new pagination model, but printing isn't using it yet.”(https://bugs.webkit.org/show_bug.cgi?id=45993)
I know the question was asked over a year ago, but I found this worked for me.
-webkit-perspective: 1;
See http://jsfiddle.net/mtpj8god/6/
More about it (from http://caniuse.com/#search=column-count, in known issues):
Chrome is reported to incorrectly calculate the container height, and
often breaks on margins, padding, and can display 1px of the next
column at the bottom of the previous column. Part of these issues can
be solved by adding -webkit-perspective:1; to the column container.
This creates a new stacking context for the container, and apparently
causes chrome to (re)calculate column layout.

Resources