html - How do I keep an overlay in the same position on screen at different resolutions? -


i haven't found answer worked me - i'm hoping can help. css skills lacking...

i have video displaying in web page have text overlay. issue on screen, overlay in correct position. when projected onto big screen, overlay in wrong position.

what best strategy use solve issue? positioning overlay in css? using panels? code follows...

css:

.video {         position:absolute;         bottom:0px;         left:0px;         width:50%;         height:80%;        }      #vidplayer {             position:absolute;             bottom:-100px;             left:0px;                     width:100%;              display:block;             z-index:99;         }      .overlaylabel {         font-size:xx-large;         font-weight:bolder;         font-style:italic;         color:antiquewhite;         position:absolute;         text-align:center;         bottom:50px;         left:100px;         width:900px;           border:2px solid red;               z-index:2147483647;     } 

html:

<div>     <article class="video">               <video id="vidplayer" title="my video" >             <source src="media/myvideo.mp4"  type="video/mp4" />         </video>         <asp:label id="lblwinner" runat="server" text="test overlay" cssclass="overlaylabel"></asp:label>            </article> </div> 

my changes fixed following problems had:

  • the css display overlay text on video (text set dynamically)
  • the video proper size
  • the overlay positioned correctly regardless of screen size

    .video {     position:relative;     width:100%;     height:auto;    }  #vidplayer {     z-index:99;     position:relative;          width:100%;      height:100%;     }  .overlaylabel {      z-index:2147483647;     position:absolute;         background-image:url("images/test.png");     -webkit-transform: rotate(13deg);     -moz-transform: rotate(13deg);     -ms-transform: rotate(13deg);     -o-transform: rotate(13deg);     transform: rotate(13deg);     font-size:xx-large;     font-weight:bolder;     text-align:center;      color:black;            bottom:44%;     left:37%;     width:30%;      height:24%;       } 

you need make design responsive.

you can either use css media queries, there different style rules, @ different resolutions ( widths ), positioning labels/text. see this.

or can use responsive units %, vh, vw instead of px positioning.

i prefer using media queries.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

node.js - Using Node without global install -

php - CakePHP HttpSockets send array of paramms -