Video Hero Issue with Bootstrap Rows - css

I have a hero video on a page I am building hover I am having an issue with my Bootstrap row that comes after the video being positioned underneath the hero. I know it has to do something with positioning but I can't seem to get it right. Any ideas how to fix this so that everything stacks correctly?
<div class="row-hero-container">
<div class="row-fluid row-hero">
<div class="video-holder gradient-overlay video-wrapper">
<video autoplay loop muted>
<source src="http://www.w3schools.com/tags/movie.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
<source src="/resources/video/product-hero.webmhd.webm" type='video/webm; codecs="vp8, vorbis"' />
<img src="/images/product/product-parent-hero.jpg" title="Your browser does not support the <video> tag">
</video>
</div>
</div>
<div class="container row-hero-overlay text-center">
<div class="row">
<div class="col-md-12 row-hero-info">
<h1 class="row-hero-title">Headline in Video.</h1>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row row-about">
<div class="col-md-6"></div>
<div class="col-md-6"></div>
</div>
</div>
JS Fiddle
http://jsfiddle.net/n3hqpgnw/

Looks like you could do it two ways here.
Just add some margin to the Top
.row-about {
background-color: black;
height: 500px;
border-top: 2px solid grey;
margin-top:1%; /* can use this to clear from above */
}
Or add some margin to the Bottom. Also I used position:relative; here to.
.video-holder {
position: relative;
width: 100%;
margin-bottom:0%; /* can use this to clear from below */
top: 0;
left: 0;
opacity: 0.8;
}
The Fiddle is here, I just turned of the red shading so it was clear to work with.
Here is a good looking video background that we helped with just the other day.
The Fiddle.
The post link.

Related

How to shrink or fit video on mobile devices in a two bootstrap columns setup?

I have two columns in Bootstrap 4, one column has a video and the other has text or other type of content:
#video-meta-content {
width: 100%;
height: 500px;
margin: 0;
padding: 0;
border: 3px solid grey;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container-fluid">
<div class="row">
<div id="vidcontainer" class="col-sm-8">
<video controls>
<p>Your browser does not support video.</p>
<source src="http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_60fps_normal.mp4">
</video>
</div>
<div class="col-sm-4 ">
<div style="" class="row" id="vid-content-row">
<div class="col-sm-12" id="video-meta-content">
few paragraoh of text here
</div>
</div>
</div>
</div>
</div>
The video size is 720 x 406. It displays correctly in desktop and landscape tablet but on phone the video is showing in a 720px wide frame, part of which is hidden due to the small screen. Some of the content column also goes on top of the video instead of stacking below the video column if screen is too small to fit both columns in one row.
I would like the video to shrink to fit screen size.
The key to getting the video to adapt to the available width is to add the following lines of css:
video {
max-width: 100%;
}
This will restrict the video to the width of its container while the height will automatically adjust to keep the aspect ratio. The video will never grow larger than it's actual size (1920px in the example below) so if the width of #vidcontainer is smaller than the video the video will constrain itself to that width, if #vidcontainer is bigger then the video will be its usual size.
You can see this by putting the below Stack Snippet into Full Page and changing the width of the browser window.
#video-meta-content {
width: 100%;
height: 500px;
margin:0;
padding:0;
border: 3px solid grey;
}
video {
max-width: 100%;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container-fluid">
<div class="row">
<div id="vidcontainer" class="col-sm-8">
<video controls>
<p>Your browser does not support video.</p>
<source src="http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_60fps_normal.mp4">
</video>
</div>
<div class="col-sm-4 ">
<div style="" class="row" id="vid-content-row">
<div class="col-sm-12" id="video-meta-content">
few paragraoh of text here
</div>
</div>
</div>
</div>
</div>
Add class col-xs-4, col-xs-8, col-xs-12 in addition to existing classes. col-xs-* is for small devices like mobile
Add class "col" in addition to "col-sm-8" and "col-sm-8".
For eg.,
class="col col-sm-8"
class="col col-sm-4"
By using ".col" bootstrap automatically handle the layout.

Bootstrap not possible to put a well in a col?

I want to put a .well div (or a button whatever), in the green area of this picture:
here
Here is my code for now:
<div class="container-fluid">
<div class="row row1" style="height: 400px;">
<div class="col-lg-4 col-lg-offset-1">
aaaa <!-- BUTTON OR WELL HERE -->
</div>
</div>
css:
.row1 {
background: url("appart.jpg");
background-size: 100% 400px;
background-repeat: no-repeat;
}
Problem, if I try this code:
<div class="container-fluid">
<div class="row row1" style="height: 400px;">
<div class="col-lg-4 col-lg-offset-1">
<div class="well well-sm">aaa
</div>
</div>
I obtain this result:
here
How can I put the .well div inside the green area (and have its height and width inferior than the green area ones)?
I am not exactly sure of what you are asking but... keep in mind the bootstrap col sizes. If you use lg it will get confused if the screen gets smaller than the lg size. Better then to use xs if you don't want to declare the other sizes.
Also, don't do inline css.
Is this what you are looking for?
Fiddle here
HTML:
<div class="container-fluid">
<div class="row backgroundPicHere">
<div class="col-xs-4 col-xs-offset-1 green">
<div class="well">Basic Well</div>
</div>
</div>
</div>
CSS:
.backgroundPicHere {
top: 20px;
height: 200px;
background: red;
}
.green{
background: green;
height: 200px !important;
}
.green .well{
position: relative;
top: 50%;
transform: translateY(-50%);
}
PS. Use any way you deem fitting for the vertical centering of the well. This is just one of many... some might disapprove. DS
EDIT: Correcting code indentation

CSS: left:auto is not overriding left:0

I am using left: auto; in the hope of overriding left: 0; but it is not working (see jsfiddle) - I want <header class="h1..."> to be center aligned.
HTML:
<div class="root">
<header class="h1 header-opacity-enabled sticky-enabled sticky-no-topbar menu-animation-enabled hover-delay-enabled sticky-collapse sticky-opacity-enabled with-search-box with-cart-box lr-mi-with-widget-visible sticky" data-sticky-trigger-position="400" data-menu-slidedown-duration="400" data-menu-slideup-duration="500" data-menu-fadein-duration="300" data-menu-fadeout-duration="400" style="top: 0px;">
<section class="main-header">
<div>
<div itemtype="http://schema.org/Organization" itemscope="itemscope" class="title">
<div class="logo-wrapper"> <a class="logo" href="https://websitetechnology.dev/" itemprop="url"> <img alt="Doig Website Technology" src="https://websitetechnology.dev/wp-content/uploads/2016/04/logo3-blue.png" itemprop="logo" height="77"> </a>
<h3>Website Engineering, Optimisation & Advertising</h3>
</div>
</div>
</div>
<div class="shopping-bag">
<div class="widget woocommerce widget_shopping_cart">
<div class="widget_shopping_cart_content">
<div class="wrap">
<p class="empty-item">There are no items in your cart.</p>
<!-- end product list -->
</div>
</div>
</div>
</div>
</section>
<div class="s-801"></div>
<div class="s-981"></div>
</header>
</div>
CSS:
.h1.sticky.sticky-opacity-enabled .main-header {
background-color: #FFFF00;
}
#media screen and (min-width: 801px) {
.root header.sticky-enabled.sticky {
margin: 0 auto;
width: 1236px;
padding: 0;
max-width: calc(1070px + 10%);
}
.root header.sticky {
position: fixed;
top: auto;
left: auto;
width: 100%;
}
}
Live site here. Scroll half way down the page until the sticky <header> pops down from the top of the window.
left: auto; is being applied, yet the <header>' is stuck to the left side of the screen. This` needs to be center aligned.
Can you help please?
I have try to solved you and attached screenshot please find it. screenshot will help you to solved your issue.
Thanks,
It must be because css specificity. In a few words:
Specificity is the means by which browsers decide which CSS property
values are the most relevant to an element and, therefore, will be
applied. Specificity is based on the matching rules which are composed
of CSS selectors of different sorts.
If you give more specific selector, you can override the settings.
In Example, a more specific selector then your would be:
div.root header.sticky {
or
body div.root header.sticky {
...
This could help: Specificity calculator
Also, if you view in Chrome i.e. you can see if a css settings was overriden by being marked as struck through
put your header inside this section
<section style="padding: 0;max-width: calc(1070px + 10%);margin: 0 auto;">
<!--- put your header section here ---->
</section>

img-resposive doesn't work

I'm using bootstrap 3 in the latest release - 3.3.4 - and unfortunately the .img-responsive class isn't working properly.
I tried everything, even .col-md-12 along with .img-responsive and nothing.
HTML:
<header class="container" id="container">
<div class="row">
<section class="col-md-3">
<a href="#">
<img class="img-responsive" src="http://placehold.it/350x150" alt="..." />
</a>
</section>
<section class="col-md-9">
<p>something else...</p>
</section>
</div>
</header>
CSS:
#container {
height: 60px;
background-color: red;
}
You can see the live preview here.
#edit
The image is over the container - the red part - that is the reason for the question, .img-responsive was supposed to resize the image to make it fit, but it doesn't.
Delete height: 60px;
You only need:
#container {
background-color: red;
}
Image has height 150px, but #container has 60px.
Your code is perfect. Here my pen http://www.bootply.com/Dka4RjELYK. Have you check your links and script references?

Slicing a box IE7 spacing problem

I'm trying to slice an box with rounded corners. The image is sliced horizontal in 3parts (top-middle-bottom). The problem in IE7 is that the top div is larger than the actual size I set.
Here is the HTML & CSS code
<!-- FIRST PICTURE -->
<div class='recent-box'>
<div class='recent-box-top'></div>
<div class='recent-box-middle' >
</div>
<div class='recent-box-bottom'></div>
</div>
<!-- FIRST PICTURE -->
<div class='recent-box'>
<div class='recent-box-top'></div>
<div class='recent-box-middle'>
</div>
<div class='recent-box-bottom'></div>
</div>
<!-- FIRST PICTURE -->
<div class='recent-box'>
<div class='recent-box-top'></div>
<div class='recent-box-middle'>
dsqd
</div>
<div class='recent-box-bottom'></div>
</div>
<!-- FIRST PICTURE -->
<div class='recent-box'>
<div class='recent-box-top'></div>
<div class='recent-box-middle'>
dsqd
</div>
<div class='recent-box-bottom'></div>
</div>
.recent-box {
width: 127px;
float:left;
display:block;
}
.recent-box-top {
float:left;
background-image: url('images/recent-foto-top.png');
background-repeat:no-repeat;
width: 100%;
}
.recent-box-middle {
float:left;
background-image: url('images/recent-foto-middle.png');
background-repeat:repeat-y;
width: 100%;
}
.recent-box-bottom {
float:left;
background-image: url('images/recent-foto-bottom.png');
background-repeat:no-repeat;
width: 100%;
}
Thanks for helping me out!
Ward
The font-size and line-height properties might be the offensive ones. If you are not placing any text in the top box, use something like
.recent-box-top {
font-size: 0;
line-height: 0;
}
Found the solution!
Just put in the div and it works like a charm!
found on http://archivist.incutio.com/viewlist/css-discuss/39150

Resources