HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<!-- CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.8.1/css/bulma.min.css">
<!-- Javascript -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<!-- Mi Javascript -->
<script defer src="portafolio.js"></script>
<main id="appPortafolio" class="container">
<!-- Navegador cetegorias -->
<div class="tabs is-centered">
<ul>
<!-- Quita la categoría activa -->
<li :class="{ 'is-active': !categoriaActiva }">
<a @click.prevent="cambiarCategoria(false)">Todas</a>
</li>
<!-- Generar las el resto de las categorías -->
<li v-for="categoria in CATEGORIAS" :class="{ 'is-active': categoriaActiva === categoria }">
<a @click.prevent="cambiarCategoria(categoria)">{{ categoria }}</a>
</li>
</ul>
</div>
<!-- Fin Navegador categorias -->
<!-- Proyectos -->
<section class="columns is-3 is-multiline">
<!-- Genera todo los proyectos -->
<article class="column is-one-third" v-for="proyecto in proyectosFiltradosCategoriaYPaginados">
<div class="media">
<div class="media-left">
<figure class="image is-64x64">
<!-- Imagen -->
<img :src="proyecto.imagen" alt="Image">
</figure>
</div>
<div class="media-content">
<div class="content">
<!-- Título -->
<h2>{{ proyecto.titulo }}</h2>
<!-- Descripción -->
<p>
{{ proyecto.descripcion }}
</p>
</div>
</div>
</div>
</article>
<!-- Fin Genera todo los proyectos -->
</section>
<!-- Fin Proyectos -->
<!-- Paginador -->
<nav class="pagination is-centered" role="navigation" aria-label="pagination">
<ul class="pagination-list">
<li>
<a class="pagination-previous" @click.prevent="retrocederPag" :disabled="!puedeRetroceder">Atrás</a>
</li>
<li>
<a class="pagination-next" @click.prevent="avanzarPag" :disabled="!puedeAvanzar">Siguiente</a>
</li>
</ul>
</nav>
<!-- Fin Paginador -->
</main>
/* Sin CSS, solo Bulma */
//===
// VARIABLES
//===
const BASE_DE_DATOS = [
{
categoria: "Front-End",
titulo: "METROZ",
descripcion:
"Occaecat sunt exercitation laboris et cupidatat amet cupidatat id. Veniam consequat id ullamco qui exercitation nulla magna nisi incididunt ullamco laboris cillum ad. Fugiat enim nostrud voluptate Lorem dolore consectetur veniam culpa duis ea. Officia eu do minim aliquip ea ad. Lorem fugiat eiusmod magna sunt deserunt eu et dolore deserunt velit laborum nostrud id. In proident Lorem ipsum ipsum consequat quis labore incididunt eu sit qui.",
imagen: "https://source.unsplash.com/64x64?cats&sig=0"
},
{
categoria: "Diseño Web",
titulo: "OBONES",
descripcion:
"Sit ex esse elit voluptate id id excepteur irure deserunt proident ullamco occaecat aute in. Nisi culpa exercitation consectetur mollit qui incididunt irure ullamco reprehenderit elit ex. Culpa in nisi laborum consectetur culpa labore occaecat in elit cillum excepteur incididunt sunt exercitation.",
imagen: "https://source.unsplash.com/64x64?cats&sig=1"
},
{
categoria: "Back-End",
titulo: "ZENSUS",
descripcion:
"Amet in consequat amet sint deserunt. Id sit ut sit in. Consectetur nisi quis dolore sit quis reprehenderit nisi tempor ex amet laboris laborum. Ipsum labore duis proident quis aute amet.",
imagen: "https://source.unsplash.com/64x64?cats&sig=2"
},
{
categoria: "Back-End",
titulo: "QUADEEBO",
descripcion:
"Laboris laborum ea velit magna consequat. Dolore veniam mollit et qui reprehenderit commodo velit. Dolor labore do id aute consectetur aliqua dolor minim exercitation non. Occaecat deserunt ut duis sint ullamco proident mollit.",
imagen: "https://source.unsplash.com/64x64?cats&sig=3"
},
{
categoria: "Diseño Web",
titulo: "ORBALIX",
descripcion:
"Ex ex velit enim elit eu deserunt minim occaecat est laboris veniam ad amet. Occaecat reprehenderit et amet eiusmod eiusmod anim exercitation deserunt. Est consectetur duis incididunt nisi commodo magna amet. Pariatur cillum laborum aute irure aute eu ipsum esse nulla labore minim aliqua magna.",
imagen: "https://source.unsplash.com/64x64?cats&sig=4"
},
{
categoria: "Front-End",
titulo: "BRAINCLIP",
descripcion:
"Aliqua sunt esse voluptate quis anim irure dolore qui id amet esse excepteur. Id ea dolore qui dolor sit reprehenderit incididunt irure nulla nisi labore sint. Magna anim in anim velit mollit excepteur aliquip eiusmod consequat cupidatat. Ad duis adipisicing mollit occaecat labore nulla et consectetur non proident dolor dolor. Aute aute occaecat aliqua amet sunt sit dolor excepteur enim minim voluptate velit eiusmod. Consequat veniam consectetur officia consectetur ullamco nulla sint cupidatat Lorem mollit laboris nulla consectetur dolore.",
imagen: "https://source.unsplash.com/64x64?cats&sig=5"
},
{
categoria: "Diseño Web",
titulo: "BUZZNESS",
descripcion:
"Veniam laboris reprehenderit qui aute do do excepteur nisi occaecat occaecat cillum voluptate labore. Enim amet sunt deserunt consequat eiusmod. Nulla laboris laborum ut et voluptate aliquip dolore eu adipisicing incididunt pariatur occaecat cupidatat nulla. Dolore reprehenderit pariatur cupidatat anim consectetur magna do consequat adipisicing dolore ut id. Consectetur dolor adipisicing non ut labore dolor aute laborum aliquip irure. Esse ullamco id anim nisi esse ex deserunt laboris cillum et eiusmod laboris amet aute. Tempor amet amet nostrud laborum voluptate labore aute reprehenderit sit commodo id ut id.",
imagen: "https://source.unsplash.com/64x64?cats&sig=6"
},
{
categoria: "Back-End",
titulo: "EXOZENT",
descripcion:
"Labore consequat do cupidatat magna mollit consequat aute velit minim. Pariatur dolor excepteur reprehenderit cupidatat ut fugiat ut quis fugiat qui ipsum incididunt sint. Qui amet aliqua mollit culpa esse occaecat veniam irure ad magna incididunt.",
imagen: "https://source.unsplash.com/64x64?cats&sig=7"
},
{
categoria: "Diseño Web",
titulo: "GINKOGENE",
descripcion:
"Ea id quis consequat culpa in fugiat nostrud Lorem ut dolor pariatur officia mollit. Nostrud mollit nisi culpa incididunt consectetur aute reprehenderit id. In dolor laborum est dolore veniam est do sunt dolore sunt consequat deserunt. In qui et proident dolore dolore est est sit tempor quis. Id qui adipisicing magna sit ut non Lorem anim tempor est amet sint mollit id.",
imagen: "https://source.unsplash.com/64x64?cats&sig=8"
},
{
categoria: "Front-End",
titulo: "CIRCUM",
descripcion:
"Ad exercitation deserunt do veniam exercitation. Pariatur est nulla esse ad aliqua amet cupidatat do minim voluptate occaecat dolore do. Officia qui minim do officia est enim culpa nostrud qui magna. Deserunt ipsum irure eiusmod laborum aliqua Lorem.",
imagen: "https://source.unsplash.com/64x64?cats&sig=9"
}
];
//===
// VUEJS
//===
new Vue({
el: "#appPortafolio",
data: {
proyectos: BASE_DE_DATOS,
CATEGORIAS: ["Diseño Web", "Front-End", "Back-End"],
PROYECTOS_POR_PAGINA: 3,
pagActual: 1,
categoriaActiva: false
},
computed: {
proyectosFiltradosCategoria: function () {
return this.proyectos.filter((proyecto) => {
return (
proyecto.categoria === this.categoriaActiva || !this.categoriaActiva
);
});
},
proyectosFiltradosCategoriaYPaginados: function () {
const CORTE_INICIO = (this.pagActual - 1) * this.PROYECTOS_POR_PAGINA;
const CORTE_FINAL = CORTE_INICIO + this.PROYECTOS_POR_PAGINA;
return this.proyectosFiltradosCategoria.slice(CORTE_INICIO, CORTE_FINAL);
},
puedeRetroceder: function () {
return this.pagActual !== 1;
},
puedeAvanzar: function () {
const ULTIMA_PAG = Math.ceil(
this.proyectosFiltradosCategoria.length / this.PROYECTOS_POR_PAGINA
);
return this.pagActual !== ULTIMA_PAG;
}
},
methods: {
cambiarCategoria: function (nombre) {
this.categoriaActiva = nombre;
this.pagActual = 1;
},
retrocederPag: function () {
if (this.puedeRetroceder) {
this.pagActual = this.pagActual - 1;
}
},
avanzarPag: function () {
if (this.puedeAvanzar) {
this.pagActual = this.pagActual + 1;
}
}
}
});
Also see: Tab Triggers