Das ist ein JS-, HTML- und CSS-Schachspiel, das ich mache. Die sichtbaren Dinge sind ein Tabellenelement mit trs und tds innerhalb der trs und imgs innerhalb der tds. Die Bilder sind ziehbar, aber für alles andere ist das Attribut „draggable“ auf „false“ gesetzt. Wenn Sie mir Code zeigen möchten, der Ihnen weiterhilft, oder wenn Sie Fragen dazu haben, zeige ich ihn gerne. Das Folgende ist mein aktuelles CSS für die Bilder:
Code: Select all
td img {
max-width: 100%;
max-height: 100%;
object-fit: contain; /* ensures the image scales within the td, maintaining aspect ratio */
position: absolute; /* centering the image vertically */
top: 50%;
left: 50%;
transform: translate(-50%, -50%); /* adjusting the image back to the center */
-khtml-user-select: none; /* stops it being highlightable */
-o-user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
user-select: none;
}