javascript - FullPage.js: issues in div positioning -
i'm using fullpage.js
( official documentation here ) need have in slide (a #section
, called in .js
) 4 boxes stacked 2 2 occupy slide, little margin around slide (like in scheme made). tried lot of ways, display: block
, float
, display: flex
; don't succeeded. best flex-box
, problem in case doesn't work safari
, android browser
. 1 can give me help? thanks!!
update
actually best results with:
<div class="section" id="section2"> <header class="header" > <h1>header</h1> </header> <div class="content"> <div class="contentflex"id="up"> <div class="flex-item" id="box1"> </div> <div class="flex-item" id="box2"> </div> </div> <div class="contentflex" id="down"> <div class="flex-item" id="box3"> </div> <div class="flex-item" id="box4"> </div> </div> </div> </div>
css:
.contentflex{ display: -webkit-box; /* old - ios 6-, safari 3.1-6 */ display: -moz-box; /* old - firefox 19- (buggy works) */ display: -ms-flexbox; /* tweener - ie 10 */ display: -webkit-flex; /* new - chrome */ display: flex; /* new, spec - opera 12.1, firefox 20+ */ padding-right:1.9em; padding-left:2em; padding-bottom:0; padding-top:0; justify-content: center; height: 20em } #up, #down{ position:relative; } .flex-item{ width: 50%; padding-right:10%; padding-left:10%; padding-top:5%; padding-bottom:5%; } .content{ position: relative; top: 50%; transform: translatey(-50%); text-align: center; }
use position:absolute
boxes , relative
sections , slides.
.section, .slide{ position:relative; } .box{ position: absolute; width:50%; height: 50%; } #box1{ background: blue; top: 0; left: 0; } #box2{ background: green; top:0; right:0; } #box3{ background: pink; bottom:0; left:0; } #box4{ background: orange; bottom:0; right:0; }
with html markup:
<div id="fullpage"> <div class="section"> <div class="box" id="box1"></div> <div class="box" id="box2"></div> <div class="box" id="box3"></div> <div class="box" id="box4"></div> </div> </div>
Comments
Post a Comment