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
.center-position { | |
position: relative; | |
} | |
.center-position .block { | |
position: absolute; | |
top: 50%; | |
left: 50%; | |
transform: translate(-50%, -50%); | |
} |
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
/* center using margin */ | |
.container .content { margin: 0 auto; } | |
/* center using inline-block */ | |
.container { text-align: center; } | |
.container .content { display: inline-block; } | |
/* center using flex */ | |
.container { display: flex; justify-content: center; } |
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
<div class="container"> | |
<div class="content">Contenido</div> | |
</div> |
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
.container { | |
display: grid; | |
place-items: center; | |
} |
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
.container { | |
display: flex; | |
justify-content: center; | |
align-items: center; | |
} |
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
<img src="placeholder.jpg" data-src="imagen-01.jpg" width="640" height="360"> | |
<img src="placeholder.jpg" data-src="imagen-02.jpg" width="640" height="360"> | |
<img src="placeholder.jpg" data-src="imagen-03.jpg" width="640" height="360"> | |
<img src="placeholder.jpg" data-src="imagen-04.jpg" width="640" height="360"> | |
<img src="placeholder.jpg" data-src="imagen-05.jpg" width="640" height="360"> | |
<img src="placeholder.jpg" data-src="imagen-06.jpg" width="640" height="360"> |
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
document.addEventListener("DOMContentLoaded", function() { | |
const lazyLoad = function() { | |
const lazyImages = document.querySelectorAll("img[data-src]"); | |
lazyImages.forEach(img => { | |
console.log(img.src, img.dataset.src); | |
if (img.getBoundingClientRect().top <= window.innerHeight | |
&& img.getBoundingClientRect().bottom >= 0 | |
&& getComputedStyle(img).display !== 'none') { | |
img.src = img.dataset.src; |
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
// declare class | |
class Popup { | |
constructor() { | |
console.log('init popup'); | |
} | |
open() { | |
console.log('open popup'); | |
} |
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
// $handle: nombre del estilo (requerido) | |
// $src: ruta del archivo a incluir (requerido) | |
// $deps: nombre del estilo dependiente, se carga el dependiente previamente | |
// $ver: versión del archivo que vamos a incluir | |
// $media: media del estilo a incluir (‘all’, ‘screen’, ‘print’, ‘handheld’) | |
wp_enqueue_style( $handle, $src, $deps, $ver, $media ); |
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
@font-face { | |
font-family: 'Open Sans'; | |
src: url('fonts/opensans-regular.woff2') format('woff2'), | |
url('fonts/opensans-regular.woff') format('woff'); | |
font-style: normal; | |
font-weight: normal; | |
} |
NewerOlder