Dynamic Vimeo button integration

Is there a way to create a button over-video design that is responsive, without using JavaScript and only inline styles?

<div class="video-container">
        <div class="overlay">
            <div class="button-container">
                <button>Click Me</button>
            </div>
        </div><iframe allowfullscreen frameborder="none" src="https://player.vimeo.com/video/55157689" style="position:absolute;top:0;left:0;width:100%;height:100%;" title="Test">
    </iframe>
    </div>

<style>
.video-container .overlay{
    position: absolute;
    width: 100%;
    height:100%;
    z-index:999;
    top: 300;
}

.video-container .overlay .button-container{
    width:100%;
    text-align:center;
}

.video-container .overlay .button-container button{
    color:#000;
    
}

.video-container iframe,
.video-container object,
.video-container embed {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
</style>

Answer №1

To vertically center items, you can apply a combination of top: 50%; and transform: translateY(-50%);

.custom-container .overlay{
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    transform: translateY(-50%);
    z-index: 999;
}

.custom-container .overlay .button-container{
    width:100%;
    text-align:center;
}

.custom-container .overlay .button-container button{
    color:#000;
}

.custom-container iframe,
.custom-container object,
.custom-container embed {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
<div class="custom-container">
  <div class="overlay">
      <div class="button-container">
          <button>Click Here</button>
      </div>
  </div>
  <iframe allowfullscreen frameborder="none" src="https://www.example.com/video" style="position:absolute;top:0;left:0;width:100%;height:100%;" title="Demo">
  </iframe>
</div>

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

Guide on how to refresh the background image using the identical URL within a directive

I am looking to refresh the background image of a div using the same URL within a directive. Upon loading my view, I utilized this directive to display the image as a background for the div. app.directive('backImg', function () { var dir ...

CSS Tricks: Placing a Panel Just Off the Page Edge

Having difficulty adjusting a panel slightly off the page like this: click here for image Attempted using width: 120% While it does work, resizing causes the image to move from its original position. I want it to remain consistent on different screens. ...

What is the method for embedding the creation date of a page within a paragraph on Wagtail?

Whenever a page is created in the admin panel of Wagtail, it automatically displays how much time has elapsed since its creation. https://i.stack.imgur.com/6InSV.png I am looking to include the timestamp of the page's creation within a paragraph in ...

Embedding complex JSON information into an HTML dropdown menu

Here is a JSON string that I am working with: { "electronics": { "cameras": [ "sony", "nikon", "canon" ], "TV": "none", "laptop": [ "hp", "apple", "sony" ] }, "home": { "furniture": [ ...

What is the best way to prevent the contents of the First Column from spilling over into the Second Column using CSS

Currently, I am working on the CSS for two column sections: section one and section two. My goal is to have the first column of section one occupy the available space without overflowing into the second column, as illustrated in this image. https://i.ssta ...

Trouble encountered with bootstrap toggling when multiple identical inputs are used

Problem with Bootstrap toggle not working on multiple identical inputs unless the first input is pressed. Even then, not all inputs are checked/unchecked. I've created a small example I want to ensure that when one input is toggled, all others have ...

Eliminate any trace of Bootstrap 4 design elements on the .card-header

I'm facing some difficulties in removing all the default styling of Bootstrap 4 from the .card component. It seems like this issue might not be directly related to Bootstrap since I am also experiencing it in Edge browser. Could someone please assist ...

A method for utilizing wildcards in conjunction with the .load function

Currently, I am utilizing jquery, jquery mobile, js, html, and css within Phonegap to develop my android/ios application. However, my understanding of js & jquery is somewhat limited. In my index.html file, I use .load to load other html files into s ...

Hiding divs toggle off when either all or only one is selected

In a certain page, there is a script that displays a div when a user selects an option. The script functions correctly, except for a scenario where if the user selects 'd' (which shows 'a', 'b', and 'c'), and then se ...

How can I detect when the user has finished typing in the input field using React?

I've implemented a highly efficient component that sends messages to the server and displays them to other users in real-time. Check out the code snippet: const ChatInput = (props) => { const [message, setMessage] = useState(''); con ...

Enhancing the layout of an ASP.NET master page with an HTML table that extends beyond the

My ASP.NET (VB) master page contains a table with 9 columns, each intended to hold textboxes. However, even without textboxes, the cells are extending beyond the content margins. How can I adjust them to fit within the master page margins? If they still ...

Issue with image preview functionality in dialog modal when loading content via ajax request

<table id="result"> <a href='#' class='pop'><span class='fa fa-eye'><img src='image link here' style='display:none'></a> </table> The hyperlink above is designed to open ...

Issues with javascript and php carousel functionality not performing correctly

I am currently in the process of creating a slideshow/carousel for a website. Recently, I implemented a PHP for-loop to iterate through a folder of images, allowing me to use the slideshow with an unspecified number of images. However, after making this ch ...

Leveraging personalized data-* attributes within the <template> tag in HTML5

I am currently developing a menu using a dom-repeat template as shown below: <template is="dom-repeat" items="{{appletsMenu}}"> <a data-route="{{item.dataRoute}}" href="{{item.href}}"> <iron-icon icon=" ...

Eliminating harmful elements in HTML code

I am looking to showcase an HTML-formatted email on a website. I am aware that HTML can contain malicious elements that should be removed before displaying it to users. This HTML email is received from an unidentified source, possibly created by a malici ...

What impact do negative positioning have on CSS elements in terms of responsibility?

Just diving into CSS and I have a question to pose: Is it considered good practice to utilize negative positioning in CSS? Are there potential compatibility issues with browsers like IE7 and IE8? What is your suggestion? #example-bottom { position: relat ...

Angular renders HTML files differently than web API responses

Having trouble displaying the content of an HTML file in a DIV - it works with a static file but fails with a dynamic file. Success with Static File: I had an EML file that I suspected needed parsing. By renaming the file extension to HTML, it rendered d ...

The two <p> elements are being pushed to the right column, which is not their intended display

A snippet of less.css code is available at this link: #content { overflow: hidden; width: 100%; p { float: left; width: 465px; padding: 0px 25px 0px 35px; margin: 0px; br { line-height: 2. ...

Are your macOS devices not displaying the Scrollbar CSS buttons correctly?

I need help troubleshooting why my buttons are not appearing in the scrollbar on macOS. They function properly on Windows, so I suspect there may be a typo or error in my code. Can anyone take a look and provide some insight? ::-webkit-scrollbar { wid ...

Having trouble installing $ npm i mini-css-extract-plugin. Any ideas on what might be causing the issue?

There seems to be an error in my setup. I am using Visual Studio Code with gitBash. $ npm i mini-css-extract-plugin npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: <a href="/cdn-cgi/l/email-p ...