Want to add animated or gify image on my website background - css

I want to add animated or gify image(Doctor treating pateint) on my website background, can anyone please suggest me with some solution, its a single page website: http://bighealth.co.in/

you can do like this:
change the url to the gif you want
change background-size: cover; to modify the way you want to display
body{
background-image: url('https://www.nasa.gov/sites/default/files/thumbnails/image/dscovrepicmoontransitfull.gif');
/* background-size: cover; */
}

If you want "high definition" animation, you need to add video as a background, if you mean this, then you need to provide the video in 3 types (.mp4, .ogg (or .ovg), webm), actually .mp4 could be enough, but will not work 100% in all brwosers, anyway here is the code:
.fullscreen-bg {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
overflow: hidden;
z-index: -100;
}
.fullscreen-bg__video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
#media (min-aspect-ratio: 16/9) {
.fullscreen-bg__video {
height: 300%;
top: -100%;
}
}
#media (max-aspect-ratio: 16/9) {
.fullscreen-bg__video {
width: 300%;
left: -100%;
}
}
#media (max-width: 767px) {
.fullscreen-bg {
background: url('../img/videoframe.jpg') center center / cover no-repeat;
}
.fullscreen-bg__video {
display: none;
}
}
<div class="fullscreen-bg">
<video loop muted autoplay poster="img/videoframe.jpg" class="fullscreen-bg__video">
<source src="http://dev2.slicejack.com/fullscreen-video-demo/video/big_buck_bunny.mp4" type="video/mp4">
<source src="http://dev2.slicejack.com/fullscreen-video-demo/video/big_buck_bunny.ogv" type="video/ogg">
<source src="http://dev2.slicejack.com/fullscreen-video-demo/video/big_buck_bunny.webm" type="video/webm">
</video>
</div>
<div class="content">
<h1>Full screen HTML5 video background</h1>
<p>Lorem ipsum dolor sit amet, vix te quidam commodo placerat. Mei ne dicunt minimum disputationi, purto everti adolescens id cum, quis veritus cotidieque eum ex. Ea eirmod atomorum posidonium sed, splendide dissentiunt an mel. Dolorem suavitate voluptatibus pro no. No duo conceptam cotidieque.</p>
<p>Pro novum argumentum ad. Vix at inani civibus, congue veritus probatus ad vel. Eam ne quis omnesque euripidis, pri ea dicat etiam ponderum. At sit harum dolor persius, eos vocent adipisci ad, magna movet audiam pri no. Erant labores incorrupte id sit, constituto scripserit theophrastus quo no.</p>
<p>Nam tacimates laboramus cu. Graeco tritani mel no. Iriure constituam mea te, quo integre salutatus ne. Case tota dicam te eam, quis minim assentior ei cum, sea eu verterem liberavisse. Modus officiis fabellas ea eos, in vis omittam ocurreret. Ea labitur assentior vix.</p>
<p>Case tation integre sit an. Te cum mollis vocent similique, docendi volumus eu nam. Erant euismod partiendo nec ei. Vel malorum liberavisse cu. Fabulas efficiantur in duo.</p>
<p>Ad qui brute fabulas rationibus, ex virtute omnesque vituperata vix. Ne case verterem probatus sit. In eam nulla tation debitis, has te alterum equidem definiebas. At summo facilisis eum. Vel ad nostro discere oportere, ad quod vitae officiis quo.</p>
<p>Case tation integre sit an. Te cum mollis vocent similique, docendi volumus eu nam. Erant euismod partiendo nec ei. Vel malorum liberavisse cu. Fabulas efficiantur in duo.Ad qui brute fabulas rationibus, ex virtute omnesque vituperata vix. Ne case verterem probatus sit. In eam nulla tation debitis, has te alterum equidem definiebas. At summo facilisis eum. Vel ad nostro discere oportere, ad quod vitae officiis quo.</p>
</div>
(click full page version to see the code running well, if run snippet not worked here, or visit the original source here)
The source of this code and more description provided here: https://slicejack.com/fullscreen-html5-video-background-css/

Related

Centering a FIXED div inside its "parent"

I swear I have checked quite thoroughly before posting this!
I am trying to center a FIXED div inside its parent div.
<div id="main">
<div id="fixed"></div>
</div>
CSS:
#main {
position: relative;
min-width: 400px; /* so it's fluid*/
background: #fff;
height: 100vh;
}
#fixed {
position: fixed;
/* center the div */
right: 0;
left: 0;
margin-right: auto;
margin-left: auto;
min-height: 10em;
width: 300px;
top: 0;
background-color: #af0000;
}
I wonder if it s possible to do with pure CSS. I can calculate the remaining space, divide it by two and change LEFT and RIGHT (i.e left: 6px; right: 6px; etc..) with JQuery but I'd like to avoid that if possible.
http://jsfiddle.net/PvfFy/980/
CSS calc() and vw (viewer width)
We can calculate measurements in CSS using this powerful addition to CSS, and combined with vw (and also vh) we can position elements quite precisely and responsively.
#main {
height: 200vh; /* force scrolling for demo */
}
#fixed {
position: fixed;
width: 300px;
height: 100px;
top: 50px;
left: calc( 50vw - 150px ); /* this is the magic */
background: blue;
}
<div id="main">
<div id="fixed"></div>
</div>
Since question was clarified (sorry for not paying closer attention)
Using position: sticky:
...will behave just like a relatively positioned element until the viewport scrolls...
Unfortunately it is (June 25, '17) less than well supported, but allows us to use margin: 0 auto; centering since #fixed is of a fixed width.
body {
margin: 0;
}
#main {
min-width: 400px; /* variable width */
width: 70vw; /* for demo */
height: 200vh;
background: rgba( 0, 255, 0, 0.2 );
}
#fixed {
position: sticky; /* this is the magic */
margin: 0 auto; /* along with this */
width: 300px;
height: 100px;
top: 50px;
background: cadetblue;
}
<div id="main">
<div id="fixed"></div>
</div>
#main {
position: relative;
min-width: 400px;
background: #fff;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
#fixed {
position: fixed;
min-height: 10em;
width: 300px;
background-color: #af0000;
}
<div id="main">
<div id="fixed"></div>
</div>
Edited answer.
I got this idea from Fred's answer. if it brings you closer go upvote his answer and not this one.
This doesn't seem to work in the viewer below unless you use fullscreen for some reason.
Maybe this will bring you closer.
You #main needs position: relative
And your #fixed needs position: sticky As well as top: 25% bottom: 25% left: 50% right: 50%
See example below:
/* start eesential CSS */
#main {
display: inline-block;
width: 30%;
min-height: 300vh;
height: auto;
position: relative;
float: right;
}
#fixed {
margin: 0 auto;
position: sticky;
top: 25%;
bottom: 25%;
left: 50%;
right: 50%;
}
/* end eesential CSS */
/* Start style fluff */
body {
margin: 0 auto;
}
#main {
background: darkred;
}
#fixed {
max-width: 100%;
height: 300px;
color: #999;
background: darkblue;
overflow-y: auto;
}
#fixed *,
#none-fixed * {
padding: 25px;
color: #999;
}
/* End style fluff */
<div id="main">
<div id="none-fixed">
<p>Lorem ipsum dolor sit amet, dolore persius at nam, ne audiam meliore quo. Vis no lobortis referrentur, ex per modo epicuri oportere. Ad primis pertinacia deterruisset eam Lorem ipsum dolor sit amet, an utinam dolorum vix, usu no sumo quaeque molestiae.
Pro mundi nemore at, tation ceteros repudiare ut eos. Usu latine ponderum deseruisse no, has doctus propriae cu. Et vim unum saepe, an commune adversarium duo. Mea ea legere doming probatus, alia mutat te ius. Lorem ipsum dolor sit amet, an utinam
dolorum vix, usu no sumo quaeque molestiae. Pro mundi nemore at, tation ceteros repudiare ut eos. Usu latine ponderum deseruisse no, has doctus propriae cu. Et vim unum saepe, an commune adversarium duo. Mea ea legere doming probatus, alia mutat
te ius. Lorem ipsum dolor sit amet, dolore persius at nam, ne audiam meliore quo. Vis no lobortis referrentur, ex per modo epicuri oportere. Ad primis pertinacia deterruisset eam Lorem ipsum dolor sit amet, an utinam dolorum vix, usu no sumo quaeque
molestiae. Pro mundi nemore at, tation ceteros repudiare ut eos. Usu latine ponderum deseruisse no, has doctus propriae cu. Et vim unum saepe, an commune adversarium duo. Mea ea legere doming probatus, alia mutat te ius. Lorem ipsum dolor sit amet,
an utinam dolorum vix, usu no sumo quaeque molestiae. Pro mundi nemore at, tation ceteros repudiare ut eos. Usu latine ponderum deseruisse no, has doctus propriae cu. Et vim unum saepe, an commune adversarium duo. Mea ea legere doming probatus,
alia mutat te ius.
</p>
</div>
<div id="fixed">
<p>Lorem ipsum dolor sit amet, dolore persius at nam, ne audiam meliore quo. Vis no lobortis referrentur, ex per modo epicuri oportere. Ad primis pertinacia deterruisset eam Lore molestiae. Pro mundi nemore at, tation
</p>
</div>
<div id="none-fixed">
<p>Lorem ipsum dolor sit amet, dolore persius at nam, ne audiam meliore quo. Vis no lobortis referrentur, ex per modo epicuri oportere. Ad primis pertinacia deterruisset eam Lorem ipsum dolor sit amet, an utinam dolorum vix, usu no sumo quaeque molestiae.
Pro mundi nemore at, tation ceteros repudiare ut eos. Usu latine ponderum deseruisse no, has doctus propriae cu. Et vim unum saepe, an commune adversarium duo. Mea ea legere doming probatus, alia mutat te ius. Lorem ipsum dolor sit amet, an utinam
dolorum vix, usu no sumo quaeque molestiae. Pro mundi nemore at, tation ceteros repudiare ut eos. Usu latine ponderum deseruisse no, has doctus propriae cu. Et vim unum saepe, an commune adversarium duo. Mea ea legere doming probatus, alia mutat
a deterruisset eam Lorem ipsum dolor sit amet, an utinam dolorum vix, usu no sumo quaeque molestiae. Pro mundi nemore at, tation ceteros repudiare ut eos. Usu latine ponderum deseruisse no, has doctus propriae cu. Et vim unum saepe, an commune adversarium
duo. Mea ea legere doming probatus, alia mutat te ius. Lorem ipsum dolor sit amet, an utinam dolorum vix, usu no sumo quaeque molestiae. Pro mundi nemore at, tation ceteros repudiare ut eos. Usu latine ponderum deseruisse no, has doctus propriae
cu. Et vim unum saepe, an commune adversarium duo. Mea ea legere doming probatus, alia mutat te ius. te ius.
</p>
</div>
<div id="none-fixed">
<p>Lorem ipsum dolor sit amet, dolore persius at nam, ne audiam meliore quo. Vis no lobortis referrentur, ex per modo epicuri oportere. Ad primis pertinacia deterruisset eam Lorem ipsum dolor sit amet, an utinam dolorum vix, usu no sumo quaeque molestiae.
Pro mundi nemore at, tation ceteros repudiare ut eos. Usu latine ponderum deseruisse no, has doctus propriae cu. Et vim unum saepe, an commune adversarium duo. Mea ea legere doming probatus, alia mutat te ius. Lorem ipsum dolor sit amet, an utinam
dolorum vix, usu no sumo quaeque molestiae. Pro mundi nemore at, tation ceteros repudiare ut eos. Usu latine ponderum deseruisse no, has doctus propriae cu. Et vim unum saepe, an commune adversarium duo. Mea ea legere doming probatus, alia mutat
te ius.
</p>
</div>
</div>
Here is a slightly silly (but working well and, unlike all the mentioned above pure CSS solutions- this one is a cross-browser one) solution with JQuery involved:
// getting initial data
var fixed = $('#fixed').width();;
var main = $('#main').width();
// getting left offset
var leftSpace = $('#main').offset().left;
// caltucating difference, dividing by two and adding left margin
var diff = (main - fixed) / 2 + leftSpace;
// updating CSS
$('#fixed').css('left', diff);
http://jsfiddle.net/PvfFy/983/

mix-blend-mode does not always work

I'm trying to achieve gradual text fading effect at the bottom of the scrollable block. Also there must be an image behind this block so simply placing color (opacity) gradient over this block won't do and mix-blend-mode must be used.
The block has the following structure:
<div id="stage"><img ...></div>
<div class="layer">
<h2>...</h2>
<div class="text">
<div class="scroll-box">
<div class="container">...</div>
::after
</div>
<div class="scroll-tools">...</div>
</div>
</div>
.container contains some text. .scroll-tools contain custom scrollbar elements (rail and thumb). Here's jsfiddle.
Almost everything there looks as it should. Except scrollbar's rail is invisible due to it being black and mix-blend-mode: screen being applied to .layer and scrollbar's thumb has wrong color.
To exclude scrollbar from being blended I tried applying mix-blend-mode to .scroll-box but for some reason this does not work.
Question1: Is it possible to achieve the same effect with text in my case without affecting scrollbar? How?
Question2: Why mix-blend-mode doesn't work when being applied to .scroll-box (or .text)?
Blend mode: screen is not the only trick in the box.
You can also use hard-light.
Using this one, the color to get transparency is gray. And white and black are preserved
.test {
width: 300px;
height: 300px;
mix-blend-mode: hard-light;
}
.box {
width: 100px;
height: 100px;
background-color: white;
display: inline-block;
}
.box:first-of-type {
background-color: black;
}
.bkg {
background-image: linear-gradient(to top, lightblue, tomato);
}
p {
position: relative;
}
p:after {
content: "";
position: absolute;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
background-image: linear-gradient(to bottom, transparent 20%, rgb(128, 128, 128) 80%);
}
<div class="bkg">
<div class="test">
<p>Lorem ipsum dolor sit amet, mel et timeam deseruisse. Ceteros repudiandae mel ad. Id tantas graece maiorum usu. Nonumes efficiendi ius te, ea harum dictas nam. Eos harum iriure regione ut. Est labitur iudicabit urbanitas et. Inermis verterem maiestatis</p><p>
</p><div class="box"></div>
<div class="box"></div>
</div>
</div>
This doesn't have cross browser support but it's fun to play with
I think it matches what you described.
With that being said, this is not really a functional answer.
.main {
height: 200px;
width:300px;
margin:0 auto;
text-align:justify;
}
.wrap {
max-height: 100%;
overflow: auto;
padding:20px;
}
.inner {
-webkit-mask-image:
linear-gradient(to top, rgba(0, 0, 0, 0)5%,/** <---- Use this to determine the cutoff point **/
rgba(0, 0, 0, .25), rgba(0, 0, 0, .5), rgba(0, 0, 0, .75), rgba(0, 0, 0, 1))
}
<div class="main">
<div class="wrap">
<div class="inner">Lorem ipsum dolor sit amet, mel et timeam deseruisse. Ceteros repudiandae mel ad. Id tantas graece maiorum usu. Nonumes efficiendi ius te, ea harum dictas nam. Eos harum iriure regione ut. Est labitur iudicabit urbanitas et. Inermis verterem maiestatis
duo ea, vix an nostrud veritus democritum, duo zril platonem ad. Cum aeque blandit appareat an, cum cu minim iusto, pro aperiam reformidans ne. Vix bonorum legimus cu, has iusto appareat eu. Etiam iracundia no has, quo velit definitiones an. Ne
quo causae interesset scribentur, et pri affert dicant, est erant noster semper ei. Ea euismod antiopam electram ius, vero homero insolens ius ad, vel prima zril id. Ius te error apeirian. Vidisse intellegebat est eu, ut mea epicurei deserunt pertinacia,
cu lorem atomorum eos. ipsum dolor sit amet, mel et timeam deseruisse. Ceteros repudiandae mel ad. Id tantas graece maiorum usu. Nonumes efficiendi ius te, ea harum dictas nam. Eos harum iriure regione ut. Est labitur iudicabit urbanitas et. Inermis
verterem maiestatis duo ea, vix an nostrud veritus democritum, duo zril platonem ad. Cum aeque blandit appareat an, cum cu minim iusto, pro aperiam reformidans ne. Vix bonorum legimus cu, has iusto appareat eu. Etiam iracundia no has, quo velit
definitiones an. Ne quo causae interesset scribentur, et pri affert dicant, est erant noster semper ei. Ea euismod antiopam electram ius, vero homero insolens ius ad, vel prima zril id. Ius te error apeirian. Vidisse intellegebat est eu, ut mea
epicurei deserunt pertinacia, cu lorem atomorum eos.</div>
</div>
</div>

How to make CSS3 column displays work in IE9

This works in FF/Chrome/Opera, and IE 10+, but not IE9; I'm looking for an IE9 solution
The following CSS will to make a set of divs, span, or p tags self-organize into neat columns that can be scrolled horizontally (Only works in WebKit enabled browsers).
-webkit-column-fill: auto;
-webkit-column-width: 300px;
-webkit-column-gap: 40px;
-moz-column-fill: auto;
-moz-column-width: 300px;
-moz-column-gap: 40px;
Here is the example:
$(document).ready(function() {
$(".RightArrow ").click(function() {
$(".columns").animate({
scrollLeft: '+=500'
}, 100);
});
$(".LeftArrow ").click(function() {
$(".columns").animate({
scrollLeft: '-=500'
}, 100);
});
}); //end script
body {
font-family: arial;
}
.columns {
overflow: hidden;
width: 500px;
border: 1px solid #000;
-webkit-column-fill: auto;
-webkit-column-width: 300px;
-webkit-column-gap: 40px;
-moz-column-fill: auto;
-moz-column-width: 300px;
-moz-column-gap: 40px;
padding: 0 20px;
text-align: left;
height: 500px;
overflow: hidden;
position: relative;
}
.notsectable {
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: -moz-none;
-o-user-select: none;
user-select: none;
}
.arrows {
width: 500px;
}
.RightArrow {
float: right;
cursor: pointer;
}
.LeftArrow {
float: left;
cursor: pointer;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="columns">
<p>
<a class="">
<h2>
<span class="">1</span>
NUM 1
</h2>
<h3>200 Broadway</h3>
<p>This transit hub is a contemporary architectural marvel in Lower Manhattan and features a Sky Reflector Net centerpiece…</p>
</a>
</p>
<p>
<a class="">
<h2>
<span class="">2</span>
NUM 2
</h2>
<h3>200 Broadway</h3>
<p>This transit hub is a contemporary architectural marvel in Lower Manhattan and features a Sky Reflector Net centerpiece…</p>
</a>
</p>
<p>
<a class="">
<h2>
<span class="">3</span>
NUM 3
</h2>
<h3>200 Broadway</h3>
<p>This transit hub is a contemporary architectural marvel in Lower Manhattan and features a Sky Reflector Net centerpiece…</p>
</a>
</p>
<p>
<a class="">
<h2>
<span class="">4</span>
NUM 4
</h2>
<h3>200 Broadway</h3>
<p>This transit hub is a contemporary architectural marvel in Lower Manhattan and features a Sky Reflector Net centerpiece…</p>
</a>
</p>
<p>
<a class="">
<h2>
<span class="">5</span>
NUM 5
</h2>
<h3>200 Broadway</h3>
<p>This transit hub is a contemporary architectural marvel in Lower Manhattan and features a Sky Reflector Net centerpiece…</p>
</a>
</p>
<p>
<a class="">
<h2>
<span class="">6</span>
NUM 6
</h2>
<h3>200 Broadway</h3>
<p>This transit hub is a contemporary architectural marvel in Lower Manhattan and features a Sky Reflector Net centerpiece…</p>
</a>
</p>
</div>
<!--columns-->
<div class="arrows">
<span class="LeftArrow"> Previose </span> <span class="RightArrow"> Next </span>
</div>
https://jsfiddle.net/n5qh89vw/
The reason I want it to work this way is I have straight output from a DB into a list of <div> s and I would like to avoid having to make it more complicated and have to have the output count the number of data items then form the markup into inline divs or tables (as in x number cells will make y columns with rows of 4) as I want to keep this as simple as possible.
Is there a way to get this to work with IE?
According to Can I Use, Multiple column layout is supported in IE 10+. If you need to support older versions of IE there is a CSS multicolumn polyfill (found in the Resources tab at Can I Use).
Now that you've updated your question to specify that you need this for IE9, here is a full example using Adam Wulf's Columnizer jQuery Plugin:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="/path-to-local-file/jquery.columnizer.min.js"></script>
<script>
$(function(){
$('.wide').columnize({width:400});
$('.thin').columnize({width:200});
});
</script>
<style>
.column p, .column h1{ padding: 5px; }
body { font-size: 9pt; }
#wrapper { margin: 0px 100px; }
.wide, .thin { clear:both; }
</style>
</head>
<body>
<div id="wrapper">
<div class="wide">
<h1>Lorem ipsum ne justo</h1>
<p>Bonorum has. His ut cibo quas tantas, vis ut probo adhuc definiebas, has at meis debet vulputate. No sed velit essent suavitate, in pro decore ceteros temporibus, usu in odio offendit theophrastus. Mel labore indoctum cu, ad soleat admodum delicatissimi sed, mei viris tritani ullamcorper eu. Ut vim simul aperiam.</p>
<p>Eu eleifend repudiandae has. Mea eu ridens aliquam. Nisl aeque sit ut, posse dolor utinam cum in. Ad timeam sapientem eos, et eripuit inermis nam. Eos integre voluptaria ne, iriure concludaturque ut eum.</p>
<p>Vis erant intellegat in. Soleat legere no ius, usu ex laoreet molestie. Sit eu sint inermis. Ea zzril scribentur pro.</p>
<h1>Tempor essent appetere</h1>
<p>Ius mutat commune expetendis in. Nam et quas sensibus reprimique, vix no erat soluta suavitate. At mel eius dictas latine. Corrumpit inciderint reformidans sed no, no usu omnis utinam noluisse.</p>
<p>Sit et, an ius nihil apeirian. Eu posse tempor iuvaret cum. No diam dolor sea, postea mnesarchum ne ius, vel no utinam ignota dolores. Malis suscipit accusamus his ne, utinam assentior prodesset ea eam, facer partem antiopam et cum.</p>
<p>Probo debet quaestio an eos, no mel assum iracundia delicatissimi, rebum facete utroque sed ex. Eu melius invidunt repudiandae vix, eu paulo reformidans deterruisset duo, solum voluptaria efficiantur ea mel. Qui summo zzril alienum et. Eu est ferri iuvaret, mazim epicurei sententiae ut cum, modo reque intellegat ex vix. Vim eu tibique accusamus, quot electram at qui.</p>
<p>Ex iisque eleifend periculis has. Sit aeterno virtute partiendo ei, eam nonumy bonorum adolescens ad. Ut nec suas vocent ornatus, cetero legendos constituam mea ea, pri cu delenit iracundia. Mundi decore nec te.</p>
<h1>Soleat civibus in pri</h1>
<p>In petentium erroribus percipitur per. Takimata accommodare ius ut, eam no postulant urbanitas. Qui ei tantas consectetuer, quis dictas euripidis duo ei. Quaeque democritum concludaturque has ne.</p>
<p>Blandit insolens constituto vix an. Has diam wisi in, eum unum repudiare no. Sit at virtute rationibus, qui vitae explicari cu. Vim ne singulis voluptatum, sed puto accusata salutandi ei. Ad mel civibus adversarium.</p>
<p>Per ne solum vivendo, fabulas dolorem vivendo in pro. Nec duis ignota cotidieque no, an per possit nostrum. Pro detraxit definitionem eu. Vivendo officiis no nam, eu has reque maiestatis percipitur, dolore reprimique accommodare cum ad. No utinam voluptua oportere pri, augue sonet dicant ei sea.</p>
<p>Sit et, an ius nihil apeirian. Eu posse tempor iuvaret cum. No diam dolor sea, postea mnesarchum ne ius, vel no utinam ignota dolores. Malis suscipit accusamus his ne, utinam assentior prodesset ea eam, facer partem antiopam et cum.</p>
</div>
<div class="thin">
<h1>Lorem ipsum ne justo</h1>
<p>Bonorum has. His ut cibo quas tantas, vis ut probo adhuc definiebas, has at meis debet vulputate. No sed velit essent suavitate, in pro decore ceteros temporibus, usu in odio offendit theophrastus. Mel labore indoctum cu, ad soleat admodum delicatissimi sed, mei viris tritani ullamcorper eu. Ut vim simul aperiam.</p>
<p>Blandit insolens constituto vix an. Has diam wisi in, eum unum repudiare no. Sit at virtute rationibus, qui vitae explicari cu. Vim ne singulis voluptatum, sed puto accusata salutandi ei. Ad mel civibus adversarium.</p>
<p>Ius mutat commune expetendis in. Nam et quas sensibus reprimique, vix no erat soluta suavitate. At mel eius dictas latine. Corrumpit inciderint reformidans sed no, no usu omnis utinam noluisse.</p>
<p>Probo debet quaestio an eos, no mel assum iracundia delicatissimi, rebum facete utroque sed ex. Eu melius invidunt repudiandae vix, eu paulo reformidans deterruisset duo, solum voluptaria efficiantur ea mel. Qui summo zzril alienum et. Eu est ferri iuvaret, mazim epicurei sententiae ut cum, modo reque intellegat ex vix. Vim eu tibique accusamus, quot electram at qui.</p>
<p>Eu eleifend repudiandae has. Mea eu ridens aliquam. Nisl aeque sit ut, posse dolor utinam cum in. Ad timeam sapientem eos, et eripuit inermis nam. Eos integre voluptaria ne, iriure concludaturque ut eum.</p>
<p>Sit et, an ius nihil apeirian. Eu posse tempor iuvaret cum. No diam dolor sea, postea mnesarchum ne ius, vel no utinam ignota dolores. Malis suscipit accusamus his ne, utinam assentior prodesset ea eam, facer partem antiopam et cum.</p>
<p>Vis erant intellegat in. Soleat legere no ius, usu ex laoreet molestie. Sit eu sint inermis. Ea zzril scribentur pro.</p>
<h1>Tempor essent appetere</h1>
<p>Ius mutat commune expetendis in. Nam et quas sensibus reprimique, vix no erat soluta suavitate. At mel eius dictas latine. Corrumpit inciderint reformidans sed no, no usu omnis utinam noluisse.</p>
<p>Sit et, an ius nihil apeirian. Eu posse tempor iuvaret cum. No diam dolor sea, postea mnesarchum ne ius, vel no utinam ignota dolores. Malis suscipit accusamus his ne, utinam assentior prodesset ea eam, facer partem antiopam et cum.</p>
<p>Blandit insolens constituto vix an. Has diam wisi in, eum unum repudiare no. Sit at virtute rationibus, qui vitae explicari cu. Vim ne singulis voluptatum, sed puto accusata salutandi ei. Ad mel civibus adversarium.</p>
<p>Per ne solum vivendo, fabulas dolorem vivendo in pro. Nec duis ignota cotidieque no, an per possit nostrum. Pro detraxit definitionem eu. Vivendo officiis no nam, eu has reque maiestatis percipitur, dolore reprimique accommodare cum ad. No utinam voluptua oportere pri, augue sonet dicant ei sea.</p>
<p>Probo debet quaestio an eos, no mel assum iracundia delicatissimi, rebum facete utroque sed ex. Eu melius invidunt repudiandae vix, eu paulo reformidans deterruisset duo, solum voluptaria efficiantur ea mel. Qui summo zzril alienum et. Eu est ferri iuvaret, mazim epicurei sententiae ut cum, modo reque intellegat ex vix. Vim eu tibique accusamus, quot electram at qui.</p>
<p>Ex iisque eleifend periculis has. Sit aeterno virtute partiendo ei, eam nonumy bonorum adolescens ad. Ut nec suas vocent ornatus, cetero legendos constituam mea ea, pri cu delenit iracundia. Mundi decore nec te.</p>
<h1>Soleat civibus in pri</h1>
<p>In petentium erroribus percipitur per. Takimata accommodare ius ut, eam no postulant urbanitas. Qui ei tantas consectetuer, quis dictas euripidis duo ei. Quaeque democritum concludaturque has ne.</p>
<p>Blandit insolens constituto vix an. Has diam wisi in, eum unum repudiare no. Sit at virtute rationibus, qui vitae explicari cu. Vim ne singulis voluptatum, sed puto accusata salutandi ei. Ad mel civibus adversarium.</p>
<p>Ius mutat commune expetendis in. Nam et quas sensibus reprimique, vix no erat soluta suavitate. At mel eius dictas latine. Corrumpit inciderint reformidans sed no, no usu omnis utinam noluisse.</p>
<p>Sit et, an ius nihil apeirian. Eu posse tempor iuvaret cum. No diam dolor sea, postea mnesarchum ne ius, vel no utinam ignota dolores. Malis suscipit accusamus his ne, utinam assentior prodesset ea eam, facer partem antiopam et cum.</p>
<p>Per ne solum vivendo, fabulas dolorem vivendo in pro. Nec duis ignota cotidieque no, an per possit nostrum. Pro detraxit definitionem eu. Vivendo officiis no nam, eu has reque maiestatis percipitur, dolore reprimique accommodare cum ad. No utinam voluptua oportere pri, augue sonet dicant ei sea.</p>
<p>Sit et, an ius nihil apeirian. Eu posse tempor iuvaret cum. No diam dolor sea, postea mnesarchum ne ius, vel no utinam ignota dolores. Malis suscipit accusamus his ne, utinam assentior prodesset ea eam, facer partem antiopam et cum.</p>
</div>
</div>
</body>
You'll need to download that file since there's no CDN for it so don't forget to change path-to-local-file to the actual location of the file.
For others who only need to support 10+, the problem here is that you're only using the vendor-prefix versions of the CSS. You need to include the normal version as well:
-webkit-column-fill: auto;
-webkit-column-width: 300px;
-webkit-column-gap: 40px;
-moz-column-fill: auto;
-moz-column-width: 300px;
-moz-column-gap: 40px;
column-fill: auto;
column-width: 300px;
column-gap: 40px;
This worked for me in IE11:
$(document).ready(function() {
$(".RightArrow ").click(function() {
$(".columns").animate({
scrollLeft: '+=500'
}, 100);
});
$(".LeftArrow ").click(function() {
$(".columns").animate({
scrollLeft: '-=500'
}, 100);
});
}); //end script
body {
font-family: arial;
}
.columns {
overflow: hidden;
width: 500px;
border: 1px solid #000;
-webkit-column-fill: auto;
-webkit-column-width: 300px;
-webkit-column-gap: 40px;
-moz-column-fill: auto;
-moz-column-width: 300px;
-moz-column-gap: 40px;
column-fill: auto;
column-width: 300px;
column-gap: 40px;
padding: 0 20px;
text-align: left;
height: 500px;
overflow: hidden;
position: relative;
}
.notsectable {
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: -moz-none;
-o-user-select: none;
user-select: none;
}
.arrows {
width: 500px;
}
.RightArrow {
float: right;
cursor: pointer;
}
.LeftArrow {
float: left;
cursor: pointer;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="columns">
<p>
<a class="">
<h2>
<span class="">1</span>
NUM 1
</h2>
<h3>200 Broadway</h3>
<p>This transit hub is a contemporary architectural marvel in Lower Manhattan and features a Sky Reflector Net centerpiece…</p>
</a>
</p>
<p>
<a class="">
<h2>
<span class="">2</span>
NUM 2
</h2>
<h3>200 Broadway</h3>
<p>This transit hub is a contemporary architectural marvel in Lower Manhattan and features a Sky Reflector Net centerpiece…</p>
</a>
</p>
<p>
<a class="">
<h2>
<span class="">3</span>
NUM 3
</h2>
<h3>200 Broadway</h3>
<p>This transit hub is a contemporary architectural marvel in Lower Manhattan and features a Sky Reflector Net centerpiece…</p>
</a>
</p>
<p>
<a class="">
<h2>
<span class="">4</span>
NUM 4
</h2>
<h3>200 Broadway</h3>
<p>This transit hub is a contemporary architectural marvel in Lower Manhattan and features a Sky Reflector Net centerpiece…</p>
</a>
</p>
<p>
<a class="">
<h2>
<span class="">5</span>
NUM 5
</h2>
<h3>200 Broadway</h3>
<p>This transit hub is a contemporary architectural marvel in Lower Manhattan and features a Sky Reflector Net centerpiece…</p>
</a>
</p>
<p>
<a class="">
<h2>
<span class="">6</span>
NUM 6
</h2>
<h3>200 Broadway</h3>
<p>This transit hub is a contemporary architectural marvel in Lower Manhattan and features a Sky Reflector Net centerpiece…</p>
</a>
</p>
</div>
<!--columns-->
<div class="arrows">
<span class="LeftArrow"> Previose </span> <span class="RightArrow"> Next </span>
</div>
The answer is simple and is NO. If you don't want to put some logic in it and divide the results into specific DIVs then you won't be able to get the desired result. sorry :(

Push floated image below text for smaller screens

quick question that's been bugging me and I cant work out how to do it. I'm wanting to have an image that's floated to the right of a paragraph of text. No problem, have got that working.
What I'm looking to do is push that image below the text for some of the media queries (say under 768px). I'm having issues doing this due to the image being the first element in the paragraph.
Thanks.
img.right {
float: right;
margin: 0 0 10px 10px;
width: 150px;
height: auto
}
<p><img class="right" src="http://icons.iconarchive.com/icons/matiasam/ios7-style/512/Clear-Tick-icon.png" />Lorem ipsum dolor sit amet, ex cum utinam nullam equidem, eam an virtute antiopam molestiae. Cum expetendis necessitatibus ea. His iisque conceptam ea, vel novum maiorum ea. Has duis tempor at, quo no elit denique fastidii. Eam justo partiendo te. Diam clita detraxit in pri, copiosae accusata sadipscing te nec. Ad soleat quaerendum pro. Id eos causae eirmod, nec libris quidam commodo cu. Vis et vidit dicam. Ipsum eruditi erroribus eam in, eum lucilius sadipscing omittantur id, aliquam adolescens id nam. Ius deleniti constituam no. Ut dicam ridens pro, qui ea viris scriptorem. Sed ei dicam graeci regione, et placerat suscipiantur has. Solum ridens eu mel. Eius omittam ex per. Summo ancillae ex vim, eam eu case dicit, ei sale primis facete sea. An vix omittam accommodare. An usu rationibus sententiae cotidieque, eu natum debet veniam eum, has ad harum urbanitas. Sumo denique ius ut, has ne harum errem moderatius. Duis habemus philosophia ius ea, cu unum vidisse tritani sea. Sit amet menandri vulputate no, ad pri quis noster eripuit. Dolore ornatus impedit ei pro, nam modo interesset ad.Et qui munere dictas noluisse. Detraxit suavitate eos ad. Ius luptatum mnesarchum ei, no quando vivendo pro. Ad suas atomorum est, cetero diceret duo ea, justo adolescens argumentum nec et.</p>
JSfiddle here
I'm sure it's a simple solution, but I haven't been able to figure it out whilst allowing the text to wrap the image at full size.
Thanks in advance!
Try like this: Demo
You can position an image at the bottom, with the help of absolute positioning along with padding bottom(Its value should be equal/greater than image height)
CSS:
p>img {
float: right;
margin: 0 0 10px 10px;
width: 150px;
height: auto
}
#media (max-width:767px) {
p {
position:relative;
height:100%;
padding-bottom:170px;
}
p>img {
position: absolute;
bottom: 0;
left:33%;
}
Solution with CSS is here and with JS is here
With Css
#media (max-width: 768px) {
img.right {
display: none;
}
img.right.visible768{
display: block;
float:none;
}
}
With JS
$(window).resize(function(){
var viewportWidth = $(window).width();
if(viewportWidth <= 768){
$('.right').appendTo('p');
}
else if (viewportWidth >= 769){
$('.right').prependTo('p');
}
});
Is this What you what
fiddle
HTML
<p>
<img class="right" src="http://icons.iconarchive.com/icons/matiasam/ios7-style/512/Clear-Tick-icon.png" />
<span class="desc">Lorem ipsum dolor sit amet, ex cum utinam nullam equidem, eam an virtute antiopam molestiae. Cum expetendis necessitatibus ea. His iisque conceptam ea, vel novum maiorum ea. Has duis tempor at, quo no elit denique fastidii. Eam justo partiendo te. Diam clita detraxit in pri, copiosae accusata sadipscing te nec. Ad soleat quaerendum pro. Id eos causae eirmod, nec libris quidam commodo cu. Vis et vidit dicam. Ipsum eruditi erroribus eam in, eum lucilius sadipscing omittantur id, aliquam adolescens id nam. Ius deleniti constituam no. Ut dicam ridens pro, qui ea viris scriptorem. Sed ei dicam graeci regione, et placerat suscipiantur has. Solum ridens eu mel. Eius omittam ex per. Summo ancillae ex vim, eam eu case dicit, ei sale primis facete sea. An vix omittam accommodare. An usu rationibus sententiae cotidieque, eu natum debet veniam eum, has ad harum urbanitas. Sumo denique ius ut, has ne harum errem moderatius. Duis habemus philosophia ius ea, cu unum vidisse tritani sea. Sit amet menandri vulputate no, ad pri quis noster eripuit. Dolore ornatus impedit ei pro, nam modo interesset ad.Et qui munere dictas noluisse. Detraxit suavitate eos ad. Ius luptatum mnesarchum ei, no quando vivendo pro. Ad suas atomorum est, cetero diceret duo ea, justo adolescens argumentum nec et.</span>
</p>
CSS
p {
display:table;
}
img.right {
float: right;
margin: 0 0 10px 10px;
width: 150px;
height: auto;
display:block
display:table-footer-group;
}
span.desc {
display:table-header-group;
}
Well, if the image is first and you need tho show it below, you have actually only two options.
Use absolute positioning of image (requires you to know its size), or using pseudo tables (no size od image required).
Here is the code: http://jsfiddle.net/yy98w8rj/1/
Pseudo tables:
.right {
float: right;
margin: 0 0 10px 10px;
width: 150px;
height: auto;
}
#media (max-width: 768px) {
p {
display: table;
}
.right {
float: none;
display: table-footer-group;
}
.text {
display: table-header-group;
}
}
<p>
<img class="right" src="http://icons.iconarchive.com/icons/matiasam/ios7-style/512/Clear-Tick-icon.png" />
<span class="text">
Lorem ipsum dolor sit amet, ex cum utinam nullam equidem, eam an virtute antiopam molestiae. Cum expetendis necessitatibus ea. His iisque conceptam ea, vel novum maiorum ea. Has duis tempor at, quo no elit denique fastidii. Eam justo partiendo te. Diam clita detraxit in pri, copiosae accusata sadipscing te nec. Ad soleat quaerendum pro. Id eos causae eirmod, nec libris quidam commodo cu. Vis et vidit dicam. Ipsum eruditi erroribus eam in, eum lucilius sadipscing omittantur id, aliquam adolescens id nam. Ius deleniti constituam no. Ut dicam ridens pro, qui ea viris scriptorem. Sed ei dicam graeci regione, et placerat suscipiantur has. Solum ridens eu mel. Eius omittam ex per. Summo ancillae ex vim, eam eu case dicit, ei sale primis facete sea. An vix omittam accommodare. An usu rationibus sententiae cotidieque, eu natum debet veniam eum, has ad harum urbanitas. Sumo denique ius ut, has ne harum errem moderatius. Duis habemus philosophia ius ea, cu unum vidisse tritani sea. Sit amet menandri vulputate no, ad pri quis noster eripuit. Dolore ornatus impedit ei pro, nam modo interesset ad.Et qui munere dictas noluisse. Detraxit suavitate eos ad. Ius luptatum mnesarchum ei, no quando vivendo pro. Ad suas atomorum est, cetero diceret duo ea, justo adolescens argumentum nec et.
</span>
</p>
Absolute positioning:
p img {
float: right;
margin: 0 0 10px 10px;
width: 150px;
height: auto
}
#media (max-width: 768px) {
p {
position: relative;
height: 100%;
padding-bottom: 170px;
}
p img {
position: absolute;
bottom: 0;
}
}
<p>
<img class="right" src="http://icons.iconarchive.com/icons/matiasam/ios7-style/512/Clear-Tick-icon.png" />Lorem ipsum dolor sit amet, ex cum utinam nullam equidem, eam an virtute antiopam molestiae. Cum expetendis necessitatibus ea. His iisque conceptam ea, vel novum maiorum ea. Has duis tempor at, quo no elit denique fastidii. Eam justo partiendo te. Diam
clita detraxit in pri, copiosae accusata sadipscing te nec. Ad soleat quaerendum pro. Id eos causae eirmod, nec libris quidam commodo cu. Vis et vidit dicam. Ipsum eruditi erroribus eam in, eum lucilius sadipscing omittantur id, aliquam adolescens id
nam. Ius deleniti constituam no. Ut dicam ridens pro, qui ea viris scriptorem. Sed ei dicam graeci regione, et placerat suscipiantur has. Solum ridens eu mel. Eius omittam ex per. Summo ancillae ex vim, eam eu case dicit, ei sale primis facete sea.
An vix omittam accommodare. An usu rationibus sententiae cotidieque, eu natum debet veniam eum, has ad harum urbanitas. Sumo denique ius ut, has ne harum errem moderatius. Duis habemus philosophia ius ea, cu unum vidisse tritani sea. Sit amet menandri
vulputate no, ad pri quis noster eripuit. Dolore ornatus impedit ei pro, nam modo interesset ad.Et qui munere dictas noluisse. Detraxit suavitate eos ad. Ius luptatum mnesarchum ei, no quando vivendo pro. Ad suas atomorum est, cetero diceret duo ea,
justo adolescens argumentum nec et.
</p>

Embedded video within responsive columns disappears in WebKit

I have been struggling with placing a YouTube video within a responsive CSS column with other content. I have used the recommended fix for responsive video scaling from CSS Tricks and other places. It works fine in Firefox, but the video disappears in Chrome and Safari. I have also tried using http://fitvidsjs.com but without success. Does anyone know of a way to get videos to appear properly within a CSS column with other content? I have also tried to work with other embedded non-video content (Issuu.com publications) and had the same problem.
Here is the CSS and HTML:
#content {
margin-left: auto;
margin-right: auto;
width: 100%;
overflow: hidden;
*zoom: 1;
overflow: hidden;
position: relative;
}
#content .content-columns {
display: inline;
float: left;
margin-left: 5%;
margin-right: 5%;
width: 90%;
-moz-column-count: 3;
-webkit-column-count: 3;
column-count: 3;
-moz-column-rule: 1px solid #ECECFB;
-webkit-column-rule: 1px solid #ECECFB;
column-rule: 1px solid #ECECFB;
-moz-column-gap: 26px;
-webkit-column-gap: 26px;
column-gap: 26px;
}
.mod-embed-video{
position: relative;
padding-bottom: 56.25%;
padding-top: 35px;
height: 0;
overflow: hidden;
}
.mod-embed-video iframe, .mod-embed-video object, .mod-embed-video embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
<div id="content">
<div class="content-columns">
<p>Lorem ipsum dolor sit amet, quodsi salutandi at mel, dicam accusamus ut mel. Tation omittam singulis nec no. Ea mea ludus corpora efficiendi. Vel id nihil legendos pertinacia, prima vocibus ut usu. Omnis delicata ut sea, lorem philosophia ex eos, an elit accommodare quo.</p>
<p>Et vim vero assum error. Sumo tantas an sit, magna dicta an mel, ut wisi feugait consequat eum. An ius recteque dignissim assueverit. Ius homero populo expetenda te, an sit amet possit pertinacia. Sed aeterno perpetua ea. Eam cu ullum dicta, commodo appareat id pro.</p>
<p>Mea cu commodo aeterno labitur, ius dolorem intellegat disputando ea, cum eros harum no. Errem principes delicatissimi in vel. Evertitur forensibus eu sea, te has eirmod tractatos consetetur. Te has vitae mandamus suscipiantur, duo labores mentitum principes eu.</p>
<p>Ad elitr vocibus vim, agam oportere est et, his eu elit facilisi tacimates. Soleat torquatos deterruisset mel ut, in tollit ocurreret his, vis et nulla epicurei vituperata. Tation euismod accusam sea in, sed modo dico ut. Pri ignota putant iudicabit ex.</p>
<p>Et vim vero assum error. Sumo tantas an sit, magna dicta an mel, ut wisi feugait consequat eum. An ius recteque dignissim assueverit. Ius homero populo expetenda te, an sit amet possit pertinacia. Sed aeterno perpetua ea. Eam cu ullum dicta, commodo appareat id pro.</p>
<div class="mod-embed-video">
<iframe width="550" height="309" src="//www.youtube.com/embed/9-5MVFMWSh0?rel=0" frameborder="0" allowfullscreen></iframe>
</div>
<p>Et vim vero assum error. Sumo tantas an sit, magna dicta an mel, ut wisi feugait consequat eum. An ius recteque dignissim assueverit. Ius homero populo expetenda te, an sit amet possit pertinacia. Sed aeterno perpetua ea. Eam cu ullum dicta, commodo appareat id pro.</p>
</div>
</div>
because you use float:left and it breaks your responsive iframe approach because position is set to absolute, therefore you get nothing. You need to find another solution where either you use another approach for columns, probably using Jquery, because column-count won't work and quite honestly I can't think of any pure html5+css approach that will allow automatic columns + responsive video

Resources