javascript - Print preview shows one div in wrong position -


i created plot in javascript , wanted show legend plot overlapping plot. function creating plot doesn't allow overlapping legend directly, leaves possibility place legend in separate div. made these 2 divs:

<div id="containinglegend">   <div id="variableplotlegend">   </div </div> 

so legend placed in div variableplotlegend.

here 2 relevant css parts:

#containinglegend{     text-align: center;     margin-top: -73px;      margin-left: 60px;     margin-right: 10px; }  #variableplotlegend{     padding: 3px;     border-color: #004790;     border-width: 1px;     border-style: solid;     background: #ffffff;     width: auto;     display: inline-block;     position:relative;     z-index:10; } 

on screen legend shown perfectly. on print shown below plot on left, in black no border etc. why?

margins aren't choose printing.

try this:

html:

<div class='container'>   <figure id='myplotchart'>     <!-- whatever plot chart html -->     <figcaption id='containinglegend'>       <div id='variableplotlegend'>         <!-- legend html -->       </div>    </figcaption>   </figure> </div> 

css:

#myplotchart {   position: relative; } #containinglegend {   display: block;   position: absolute;   bottom: 15px;   left: 50%;   transform: translatex(-50%); } 

this gives benefit of being semantically correct html, , figure , figcaption have relationship you're after far positioning.


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -