Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

HTML & CSS Slide in and out

KittenKatja

Well-Known Coder
I have a span element, with JS, I make it visible with "display: flex;" and insert source for the video or image element inside.
The problem is that I can't accurately place it where I want it to be, or make it act with JS.
HTML:
<html>
    <head>
        <style>
            #corner {box-shadow: 0 0 3px 5px hotpink;background-color: hotpink;/*left and top don't work*/transform: translate(calc(300% - 670px), 700px);flex-direction: row;max-width: fit-content;max-height: fit-content;animation: opacity .3s linear;}
            [in]#corner, #corner:hover {opacity: 1;}
            #corner :is(video,image) {max-height: 300px;max-width: 300px;position: relative;left: 0;top 0;}
            #corner-toggle {width: 40px;height: 100%;}
        </style>
    </head>
    <body style="overflow: hidden;">
        <a onclick="document.getElementById('corner-video').src='';document.getElementById('corner-image').src='';document.getElementById('corner').style.display='none'">Remove</a>
        <span id="corner">
            <a id="corner-toggle">Toggle</a>
            <div>
                <video id="corner-video" autoplay loop></video>
                <image id="corner-image"></image>
            </div>
        </span>
    </body>
</html>
I want to put it into the bottom right corner, regardless of how devtools is altering the viewport.
When the attribute "in" is not present, it should go out of view only so much that the toggle button is visible.
Video and image should occupy the same space, but for some reason, image is a small, invisible dot in the bottom right corner of the video, stretching the whole construct by itself.
It's also noteworthy, that I have another video element as the background, which has the min-width 100%, and extend left and right without overflowing (IDK why) and the corner construct is the first to cause the overflow scroll to appear, but it is possible that width 100% is not viewport width 100% because of it.

I have another video element at the top.
It usually plays videos with low height and high width, and the way it is currently setup, it looks like it's centered, but it's not when another video with different dimensions is occupying the spot.
I'd like to actually center it.
 
I have a span element, with JS, I make it visible with "display: flex;" and insert source for the video or image element inside.
The problem is that I can't accurately place it where I want it to be, or make it act with JS.
HTML:
<html>
    <head>
        <style>
            #corner {box-shadow: 0 0 3px 5px hotpink;background-color: hotpink;/*left and top don't work*/transform: translate(calc(300% - 670px), 700px);flex-direction: row;max-width: fit-content;max-height: fit-content;animation: opacity .3s linear;}
            [in]#corner, #corner:hover {opacity: 1;}
            #corner :is(video,image) {max-height: 300px;max-width: 300px;position: relative;left: 0;top 0;}
            #corner-toggle {width: 40px;height: 100%;}
        </style>
    </head>
    <body style="overflow: hidden;">
        <a onclick="document.getElementById('corner-video').src='';document.getElementById('corner-image').src='';document.getElementById('corner').style.display='none'">Remove</a>
        <span id="corner">
            <a id="corner-toggle">Toggle</a>
            <div>
                <video id="corner-video" autoplay loop></video>
                <image id="corner-image"></image>
            </div>
        </span>
    </body>
</html>
I want to put it into the bottom right corner, regardless of how devtools is altering the viewport.
When the attribute "in" is not present, it should go out of view only so much that the toggle button is visible.
Video and image should occupy the same space, but for some reason, image is a small, invisible dot in the bottom right corner of the video, stretching the whole construct by itself.
It's also noteworthy, that I have another video element as the background, which has the min-width 100%, and extend left and right without overflowing (IDK why) and the corner construct is the first to cause the overflow scroll to appear, but it is possible that width 100% is not viewport width 100% because of it.

I have another video element at the top.
It usually plays videos with low height and high width, and the way it is currently setup, it looks like it's centered, but it's not when another video with different dimensions is occupying the spot.
I'd like to actually center it.
Hey there,
Question for ya: Are you intending for the video to be full width?
1678037952453.png
 

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom