how to share the same div in two places - html

I want to share the same player not sure how to go about this without javascript and without duplicated player.
Basically, I have the following for mobile:
<div class="d-block d-lg-none d-xl-none d-xxl-none">
<div id="player"> <!-- video player here --> </div>
</div>
And for desktops:
<div class="d-none d-lg-block d-xl-block d-xxl-block">
<div class="container">
<div class="row">
<div id="player"> <!-- same video player here --> </div>
</div>
</div>
</div>
Is there a way to achieve this?
Update: When a user have a desktop browser open that doesn't take all the screen it will show (probably) the first block of code when he adjust so it will take the full screen it will show the second block of code how can I keep the player in his current state from the first block of code to the second one or somehow move it keeping its state?

.d-block{
display:none;
}
#media (max-width: 800px){
.d-block{
display:block;}
.d-none{
display:none;}
}
<div class="d-block d-lg-none d-xl-none d-xxl-none">x
<div id="player"> <!-- video player here --> </div>
</div>
<div class="d-none d-lg-block d-xl-block d-xxl-block">y
<div class="container">
<div class="row">
<div id="player"> <!-- same video player here --> </div>
</div>
</div>
</div>

You can use css media queries to get your result. It'll resize the div based on the viewport width.

Related

Visualizing Bootstrap 4.x Grid Breakpoints during development

If you use grid system in Bootstrap 4.x, it can be useful to know exactly which grid breakpoint corresponds to the current viewport width.
You can accomplish this by adding the following HTML at the top of your page. When you resize the browser window, the corresponding size will be displayed.
<div class="d-block d-sm-none">
<b>Extra Small</b> <576px
</div>
<div class="d-none d-sm-block d-md-none">
<b>Small</b> ≥576px
</div>
<div class="d-none d-md-block d-lg-none">
<b>Medium</b> ≥768px
</div>
<div class="d-none d-lg-block d-xl-none">
<b>Large</b> ≥992px
</div>
<div class="d-none d-xl-block">
<b>Extra Large</b> ≥1200px
</div>
When you resize your browser window, you can see what the current grid breakpoint is. Remeber to remove this when development is done.

Why is bootstrap not aligning cells correctly?

I'm trying to use Bootstrap, and having an issue that in medium resolution two columns that should be side-by-side, are displaying underneath each other, see screenshot http://dynanetics.com/problem-screenshot.png, the code is at http://dynanetics.com
At higher resolutions (large and xlarge) this works correctly. Why is this happening at medium resolution?
Any help would be appreciated, thanks.
The relevant code is below:
<div class="container">
<div class="row">
<div class="col-md-4">
<div class="row">
<div class="col-md-3 d-block float-left">
<img src="logo-sitesmall.png" class="d-block float-none">
</div>
<div class="col-md-6 d-block float-left text-center">
<h1 class="brandname">Test site name</h1>
</div>
</div>
</div>
<div class="col-md-4">
</div>
</div>
</div>
I think your div="col-md-4", after first row div is too small for both the content to be on same line in medium resolution, try to increase it.

Bootstrap 4 ordering class

I have a question about the bootstrap 4.1 reordering. According to the documentation:
Reordering
Use .order- classes for controlling the visual order of
your content. These classes are responsive, so you can set the order
by breakpoint (e.g., .order-1 .order-md-2). Includes support for 1
through 12 across all five grid tiers.
I've tried to set the reordering only on small and medium screens, using the .orderclasses as showed in the docs, but it will reorder the contents also on larger breakpoints, I'm doing this wrong?
<div class="container-fluid">
<div class="row">
<div class="col-sm-12 col-lg-4 order-sm-2">
<!-- some contents here -->
</div>
<div class="col-sm-12 col-lg-8 order-sm-1">
<!-- some contents here -->
</div>
</div>
</div>
You need re-order in larger breakpoints, because bootstrap is mobile first approach, (it means it is using min-width in media queries), so when only using sm it will apply properties from sm and up (including md and lg).
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid">
<div class="row">
<div class="col-sm-12 col-lg-4 order-sm-2 order-lg-1">
mobile 2nd and then desktop 1st
</div>
<div class="col-sm-12 col-lg-8 order-sm-1 order-lg-2">
mobile 1st and then desktop 2st
</div>
</div>
</div>
One more thing to know about order in BS4, is that you can you use order-X-first, order-X-last and order-X-0, so here a snippet with those classes. You can see them in this answer
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid">
<div class="row">
<div class="col-sm-12 col-lg-4 order-sm-last order-lg-first">
mobile 2nd and then desktop 1st
</div>
<div class="col-sm-12 col-lg-8 order-sm-first order-lg-last">
mobile 1st and then desktop 2st
</div>
</div>
</div>
This is the default behavior of Bootstrap and is expected.
To say it in short words, all bootstrap's breakpoint suffixes (-sm -md ...) work from that breakpoint upward.
So if you set col-sm-6 that means your column will be half the size of row from in sm breakpoint and md and lg unless you overwrite it (e.g. col-md-2 ).
It all goes back here (using min-width in media queries)
Here is an example, how you can do this with media queries:
<div class="row">
<div class="col-12">
<!-- some content -->
</div>
<div class="col-md-9">
<!-- some content -->
</div>
<div class="col-md-3 move-down">
<!-- some content -->
</div>
<div class="col-md-6 move-up">
<!-- some content -->
</div>
<div class="col-md-6">
<!-- some content -->
</div>
</div>
#media (max-width: 767px) {
.move-down {
order: 2;
}
.move-up {
order: 1;
}
}
Have you tried doing order-1, this sets the default for larger screens
<div class="col-sm-12 col-lg-4 order-1 order-sm-2">
<!-- some contents here -->
</div>
<div class="col-sm-12 col-lg-8 order-2 order-sm-1">
<!-- some contents here -->
</div>
Source: Column ordering in Bootstrap 4
I ran into some issues with this as well. Here's the following code that got it to work for me:
<div class="container-fluid">
<div class="row">
<div class="col-sm-6 order-sm-2 order-1">
<!-- some contents here -->Content1
</div>
<div class="col-sm-6 order-sm-1 order-2">
<!-- some contents here -->Content2
</div>
</div>
</div>
Edit: Removed .order-md class from respective columns.

Resizing Jumbotron

I want to reduce jumbotron's height not with pixels but percentage of something (ex. div's height, windows height). What is the best way to do it appropriate with different window sizes and responsive design.
Here is my code:
<!-- START PAGE CONTENT WRAPPER -->
<div class="page-content-wrapper">
<!-- START PAGE CONTENT -->
<div class="content">
<div class="social-wrapper">
<div class="social " data-pages="social">
<!-- START JUMBOTRON -->
<div class="jumbotron" data-pages="parallax" data-social="cover">
<div class="cover-photo">
<img alt="Cover photo" src="assets/img/social/cover.png" />
</div>
<div class="container-fluid container-fixed-lg sm-p-l-20 sm-p-r-20">
<div class="inner">
<div class="pull-bottom bottom-left m-b-40">
<h5 class="text-white no-margin">Team Members</h5>
<h1 class="text-white no-margin"><span class="semi-bold">Lemp</span> Team</h1>
</div>
</div>
</div>
</div>
<!-- END JUMBOTRON -->
</div>
<!-- END PAGE CONTENT -->
Thanks.
You can make the jumbotron maintain aspect ratio.
Check Sean Dempsey fiddle.
Just modify
<div class="box sixteen-nine">
<div class="content">
<span>16:9</span>
</div>
to your jumbotron
You can see Chris Coyer full explanation

Bootstrap - Keep Div and Image on same row at same height

How can I the div on the left and the image on the right at the same height using Bootstrap? They can stack when the screen width gets smaller, but at larger sizes they need to be equal.
<!-- main -->
<div id="main" class="row">
<div class="left col-md-6">
<h1>SCAQMD's Air Alerts lets you stay informed about air quality in your area.</h1>
<div id="round">
<img src="img/arrow.png" alt="arrow">
Sign Up
</div>
<div id="signup">
<h2>SIGN UP TODAY</h2>
<div><!-- line -->
</div>
<h3>to receive Air Alerts<br>Customized for you!</h3>
</div>
</div>
<div class="right col-md-6">
<img src="img/hero.jpg" class="pull-right img-responsive">
</div>
</div>
<!-- main -->