The video controls cannot be seen

I'm encountering an issue while trying to incorporate controls into a full-width HTML5 video. Despite following this example: https://jsfiddle.net/nfouvpe5/, the controls remain invisible. Below is the code snippet I am using:

<div class="overlay"></div>
  <video playsinline="playsinline" autoplay="autoplay" muted="muted" loop="loop" controls>
    <source src="https://storage.googleapis.com/coverr-main/mp4/Mt_Baker.mp4" type="video/mp4">
  </video>
  <div class="container h-100">
    <div class="d-flex h-100 text-center align-items-center">
      <div class="w-100 text-white">
        <h1 class="display-3">Video Header</h1>
        <p class="lead mb-0">With HTML5 Video and Bootstrap 4</p>
      </div>
    </div>
  </div>

CSS

header {
  position: relative;
  background-color: black;
  height: 75vh;
  min-height: 25rem;
  width: 100%;
  overflow: hidden;
}

header video {
  position: absolute;
  top: 50%;
  left: 50%;
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  z-index: 0;
  -ms-transform: translateX(-50%) translateY(-50%);
  -moz-transform: translateX(-50%) translateY(-50%);
  -webkit-transform: translateX(-50%) translateY(-50%);
  transform: translateX(-50%) translateY(-50%);
}

header .container {
  position: relative;
  z-index: 2;
}

header .overlay {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background-color: black;
  opacity: 0.5;
  z-index: 1;
}

I'd appreciate any assistance with this matter. Can anyone pinpoint what I might be doing incorrectly? Why are the controls not appearing on the video?

Answer №1

Let's tackle two key issues here:

1) To address the issue mentioned in the comments, both .overlay and the header's .container are preventing mouse interaction with the video. This can be resolved by adding the attribute pointer-events: none; to both elements. This adjustment enables us to easily pause/unpause the video by clicking on it.

2) By setting

min-width: 100%; min-height: 100%; width: auto; height:auto;
, your method of defining the video size is causing an overwrite of the width and height properties after min-width and min-height. The real issue lies in the controls being positioned at the bottom of the video, hidden behind the <section>. While this may be a deliberate design choice, you could consider setting height: 100% and incorporating black borders around the video to maintain its aspect ratio.

I will continue exploring solutions such as repositioning the video controls to maintain the "cover" effect of filling the screen while also ensuring full functionality. Implementing step (1) should already provide some helpful improvements.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Discovering the Secrets of Accessing and Modifying Item Values in BIRT

Is it feasible to create using only Javascript without utilizing any Java functions? Is there a way to access values from elements like labels, tables, or charts by calling them from an HTML button? I am currently working with Openlayers and BIRT. I need ...

Troubleshooting Angular JS loading problems

I'm attempting to implement the Angular-Spinner in my project: Specifically, I want to use it with http.get calls. This is what I have so far: Within controllers: $scope.loading = true; $http.get('js/data/test.json').success(function(resu ...

Tips for managing multiple events within a single component in Angular 4

Currently, I am working on developing a user interface layer for an application using Angular 4. The page layout I have consists of displaying data in tables based on search criteria. At the moment, I have code that displays the data in one HTML file (rec ...

Adapt appearance according to the length of the text

Currently, I have an array that stores multiple strings based on displayed charts. My objective is to find the longest string within this array. So far, this task has been executed without any issues. The code snippet for this process is as follows: var ...

I am unable to view the map on my webpage. This issue only arises when I apply a CSS style to it

Hey there! I'm having trouble displaying a map on my website. For some reason, the map is not showing up even after updating the Google secret key in my code: <?php session_start(); include '../../WSweb/serv.php'; if(isset($_SESSION[&a ...

Trouble with AJAX POST request functionality outside of POSTMAN's scope

Attempting to send data via an AJAX request. Check out the code below: console.log(quote) $.ajax({ url: '{{ path('set_products_in_db') }}', type: 'POST', contentType: "application/json", ...

Exploring the power of JSON and JavaScript: A guide to efficiently reading lists through JSON manipulation

I am facing an issue where I am unable to read an object using the method below function loadData(){ $.getJSON('data.json', function(data) { $.each(data, function(Index, entry) { mem = new user(entry.name, entry.age, entr ...

Styling with react-jss based on intricate conditionals

After experimenting with react-jss for a few weeks, I am faced with the challenge of styling components efficiently. With numerous conditionals in these components, I am striving to avoid creating an excess of new components that essentially share the same ...

Leveraging jQuery to access data attributes in JSON data using AJAX requests

I am having success with a simple ajax call that returns JSON data. However, I am facing difficulties selecting elements with jQuery after the ajax call. Could this be because of how they are loaded? Currently, I am attempting to alert the contents of one ...

CSS: Unexpected value, received NaNrgb

I was attempting to incorporate a checkbox into a Bootstrap form that turns green when it is checked. Here is the code I used: function updateColor() { $("#check1").animate({ "background-color": "rgb(209, 231, 221)" }); } <script src="http ...

Turn off hover effect using solely CSS

This is my first time posting on stackoverflow, so please excuse me if I overlook something obvious. I tried searching for a solution beforehand but couldn't find one that seemed relevant. In the following jsfiddle example, I have a div that acts as ...

What could be the reason behind my Javascript code returning "object object"?

I am a beginner with jQuery. I attempted to calculate the sum of items from my django views using jQuery. Here's what I have so far: $(document).ready(function() { var sch = $('#sch-books'); var gov = $('#gov-books'); ...

What is the most effective way to verify numerical values, including both integers and decimals, using regular

Allow input as both integers and decimal numbers, with a total length restriction of 11 characters (including the decimal point). For example, allowed values include: 1.0, 1.123546, 12345678912, 12.12345678, etc. If the value contains a decimal point, ther ...

Top method for displaying radio buttons as switchable buttons within a web form

I want to customize the appearance of my radio buttons on a form to make them look like toggle-able HTML buttons, similar to the examples shown in these Bootstrap examples. By using Flask, Bootstrap, and jinja2, I've successfully converted my radio bu ...

Putting an <input/> element inside a Material UI's <TextField/> component in ReactJS - a beginner's guide

I am attempting to style <TextField/> (http://www.material-ui.com/#/components/text-field) to resemble an <input/>. Here is what I have tried: <TextField hintText='Enter username' > <input className="form-control ...

The jQuery hover script behaves erratically

I have a simple jQuery script that elevates an image when hovered over. However, the hover effect sometimes does not work as expected. I am looking for additional ways to modify the script to ensure that it functions smoothly all the time, rather than spor ...

The image displayed on the HTML scrset attribute is not the correct one

I'm experiencing an issue with correctly loading the responsive image using scrset. The sizes attribute I am using is: sizes="(max-width: 767px) 95vw, 768px" and for the srcset attribute: srcset="https://cdn.runningshoesguru.com/wp-content/uploads ...

Sending data from one HTML element to another using JQuery's Ajax function

I'm currently attempting to pass the value from an anchor tag into an ajax function. This is the HTML code I am working with <section> <div class="nav-section"> <nav> <ul> <li>< ...

Can a substring within a string be customized by changing its color or converting it into a different HTML tag when it is defined as a string property?

Let's discuss a scenario where we have a React component that takes a string as a prop: interface MyProps { myInput: string; } export function MyComponent({ myInput }: MyProps) { ... return ( <div> {myInput} </div> ...

Automatically adjusting the image to fit the screen size

The image on the screen is not resizing properly. Please refer to the image with the alternate text google-play-badge. Even though the width and height of the image are set to auto, it is still not adjusting automatically. https://i.sstatic.net/Tu97S.jpg ...