View Single Post
Old 09-12-2019, 12:07 AM   #1
AliceWonder
Connoisseur
AliceWonder ought to be getting tired of karma fortunes by now.AliceWonder ought to be getting tired of karma fortunes by now.AliceWonder ought to be getting tired of karma fortunes by now.AliceWonder ought to be getting tired of karma fortunes by now.AliceWonder ought to be getting tired of karma fortunes by now.AliceWonder ought to be getting tired of karma fortunes by now.AliceWonder ought to be getting tired of karma fortunes by now.AliceWonder ought to be getting tired of karma fortunes by now.AliceWonder ought to be getting tired of karma fortunes by now.AliceWonder ought to be getting tired of karma fortunes by now.AliceWonder ought to be getting tired of karma fortunes by now.
 
Posts: 97
Karma: 200000
Join Date: Aug 2019
Device: none
Centering svg node in xhtml

Cover page uses svg so that I can typeset text on the image and text is always sharp regardless of the device resolution.

In portrait works fine - the aspect ratio of devices are such that the image is always 100% of width. But in landscape the image is the way the left and nothing I've tried w/ CSS will center it.

Code:
<body>
<div class="coverpage">
<svg xmlns="http://www.w3.org/2000/svg"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  version="1.1" width="100%" height="100%"
  viewBox="0 0 800 1120" preserveAspectRatio="xMinYMin">
  <!-- svg code -->
</svg>
</div>
</body>
Help?
AliceWonder is offline   Reply With Quote