Last active
December 13, 2017 02:54
-
-
Save mattymil/b7b793bf90399f7c2f5b10f33ddcae6e to your computer and use it in GitHub Desktop.
Background image in Polymer component example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="import" href="../../bower_components/polymer/polymer.html"> | |
<dom-module id="tester-app"> | |
<template> | |
<style> | |
:host { | |
display: block; | |
} | |
img.bg { | |
/* Stick it to the upper left hand corner */ | |
position: fixed; | |
top: 0; | |
left: 0; | |
/* Make it stretch to any screen size */ | |
width: 100%; | |
height: auto; | |
min-height: 100%; | |
/* set min-width to image width to maintain scale */ | |
min-width: 1024px; | |
/* Make the deepest layer */ | |
z-index: -999; | |
} | |
@media screen and (max-width: 1024px) { /* recenter the image on smaller screens */ | |
img.bg { | |
left: 50%; | |
margin-left: -512px; /* 50% */ | |
} | |
} | |
</style> | |
<img class="bg" src="../images/seigaiha.png" alt=""> | |
<h1>Test</h1> | |
</template> | |
<script> | |
Polymer({ | |
is: 'tester-app', | |
properties: { | |
prop1: { | |
type: String, | |
value: 'tester-app', | |
}, | |
}, | |
}); | |
</script> | |
</dom-module> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment