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.
<!DOCTYPE html>
<html lang="es">
<noscript class="" style="display:none;">
<?php
$debug = 0;
$seguir = 0;
//$datos = array_merge($datos,$usr_info->
$session = session();
$usr_info = $session->get('usr_info');
//dd($session->get('lang'));
//dd($usr_info);
if(isset($error)){
echo '<script> alert(\''.$error.'\')</script>';
}
?></noscript>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title><?=$titulo;?></title>
<noscript class="" style="display:none;">@include('dashboard.includes.headerdashboardlinks')</noscript>
</head>
<body class="fixed-nav sticky-footer" id="page-top">
<noscript class="" style="display:none;">@include('dashboard.includes.headerdashboardmenu')</noscript>
<div class="content-wrapper">
<div class="container-fluid">
<!-- Breadcrumbs-->
<!--<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="/dashboard#">{{trans('trad.panel-dash') }}</a>
</li>
<li class="breadcrumb-item active">{{trans('trad.cambioclave-dash') }}</li>
</ol>-->
<!-- /box_general-->
<div class="row">
<div class="col-md-12">
<div class="box_general padding_bottom">
<div class="container">
<div id="calendar" class="calendar">
<div class="calendar-title">
<div class="calendar-title-text"></div>
<div class="calendar-button-group">
<button id="prevMonth"><</button>
<button id="today">Hoy</button>
<button id="nextMonth">></button>
</div>
</div>
<div class="calendar-day-name"></div>
<div class="calendar-dates"></div>
</div>
<!-- calendar-left -->
<!-- container -->
</div>
</div>
</div>
<!-- /row-->
</div>
<script type="text/javascript" src="https://unpkg.com/[email protected]/dayjs.min.js"></script>
<script>
/*
_____ _____ __ _____ _____ ____ _____ _____
| | _ | | | __| | | \| _ | __ |
| --| | |__| __| | | | | | | -|
|_____|__|__|_____|_____|_|___|____/|__|__|__|__|
_____ _____ _____ __ ____ _____ _____
| __ | | | | | | \| __| __ |
| __ -| | |- -| |__| | | __| -|
|_____|_____|_____|_____|____/|_____|__|__|
*/
let currentDate = dayjs(),
daysInMonth = dayjs().daysInMonth(),
firstDayPosition = dayjs().startOf("month").day(),
monthNames = ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"],
weekNames = ["Lun", "Mar", "Mié", "Jue", "Vie", "Sáb", "Dom"],
dateElement = document.querySelector("#calendar .calendar-dates"),
calendarTitle = document.querySelector(".calendar-title-text"),
nextMonthButton = document.querySelector("#nextMonth"),
prevMonthButton = document.querySelector("#prevMonth"),
dayNamesElement = document.querySelector(".calendar-day-name"),
todayButton = document.querySelector("#today"),
dateItems = null,
newMonth = null;
function plotDays() {
let t = 1;
dateElement.innerHTML = "";
let e = currentDate.subtract(1, "month").endOf("month").$D,
n = [];
for (let a = 1; a < firstDayPosition; a++) n.push(e--);
n.reverse().forEach(function(t) {
dateElement.innerHTML += `<button class="calendar-dates-day-empty">${t}</button>`
});
for (let r = 0; r < daysInMonth; r++) dateElement.innerHTML += `
<button class="calendar-dates-day">
${t++}
<div class="date-marker">
`+`
<noscript class="" style="display:none;"><?php
echo '<div class="ball" style="background: red;"></div>';
echo '<div class="ball" style="background: blue;"></div>';
echo '<div class="ball" style="background: orange;"></div>';
?></noscript>`+
`
<div class="ball" style="background: purple;"></div>
</div>
</button>`;
let o = 42 - Number(document.querySelector(".calendar-dates").children.length),
d = 1;
for (let l = 0; l < o; l++) document.querySelector(".calendar-dates").innerHTML += `<button class="calendar-dates-day-empty">${d++}</button>`;
calendarTitle.innerHTML = `${monthNames[currentDate.month()]} - ${currentDate.year()}`
}
function highlightCurrentDate() {
dateItems = document.querySelectorAll(".calendar-dates-day"), dateElement && dateItems[currentDate.$D - 1] && dateItems[currentDate.$D - 1].classList.add("today-date")
}
function setSelectedMonth() {
daysInMonth = newMonth.daysInMonth(), firstDayPosition = newMonth.startOf("month").day(), currentDate = newMonth, plotDays()
}
weekNames.forEach(function(t) {
dayNamesElement.innerHTML += `<div>${t}</div>`
}), nextMonthButton.addEventListener("click", function() {
newMonth = currentDate.add(1, "month").startOf("month"), setSelectedMonth()
}), prevMonthButton.addEventListener("click", function() {
newMonth = currentDate.subtract(1, "month").startOf("month"), setSelectedMonth()
}), todayButton.addEventListener("click", function() {
newMonth = dayjs(), setSelectedMonth(), setTimeout(function() {
highlightCurrentDate()
}, 50)
}), plotDays(), setTimeout(function() {
highlightCurrentDate()
}, 50);
</script>
<!-- /.container-fluid-->
<noscript class="" style="display:none;">
@include('dashboard.includes.dashboardfooter')
<?php
echo '<div class="ball" style="background: red;"></div>';
echo '<div class="ball" style="background: blue;"></div>';
echo '<div class="ball" style="background: orange;"></div>';
?>
<noscript>
</body>
</html>
.ball{width: 5pt;height: 5pt;border-radius: 100%;/* border: solid 1pt white; */margin-right: 1px;}
.date-marker {width: 0; height: 3pt;/* margin: auto; */ bottom: 0pt;display: -webkit-box;position: relative;}
/* {position: relative;width: 0;height: 5px;margin: auto;bottom: 5px;display: inline-block;} */
@import url(https://fonts.googleapis.com/css2?family=Manrope:wght@200;300;400;500;600&display=swap);.calendar{max-width:300px;margin:30px auto;padding:20px;box-sizing:border-box;background:#fff;border-radius:12px;box-shadow:0 0 3px #dadada}.calendar .calendar-dates,.calendar .calendar-day-name{display:grid;grid-template-columns:repeat(7,1fr);grid-gap:8px}.calendar .calendar-dates-day{font-family:Manrope,sans-serif;font-size:13px;border:1px solid #efefef;padding:4px;box-sizing:border-box;background:#f8f8f8;border-radius:4px;color:#333}.calendar .calendar-dates-day-empty{background:0 0;border:0;color:#dcdcdc;min-height:28px}.calendar .calendar-day-name div{text-align:center;margin-bottom:12px;font-size:13px;font-weight:700}.calendar .calendar-title{padding-bottom:16px;text-align:center;font-weight:500;display:flex;justify-content:space-between;border-bottom:1px solid #ddd;margin-bottom:12px}.calendar .calendar-dates-day.today-date{background:#555;color:#fff}.calendar #nextMonth,.calendar #prevMonth,.calendar #today{padding:2px 6px;box-sizing:border-box;font-family:Manrope,sans-serif;font-size:20px;line-height:20px;border:1px solid #e0e0e0;border-radius:4px;cursor:pointer;color:#333}.calendar #today{font-size:13px}.calendar .calendar-title-text{display:flex;align-items:center;font-size:14px;font-weight:700}.calendar .calendar-button-group{display:flex;align-items:center;gap:8px}
/*
_____ _ __ _ _
| __|_ _ ___ ___| |_ | | |_|___| |_ ___ ___ ___ ___ ___
| __| | | -_| | _| | |__| |_ -| _| -_| | -_| _|_ -|
|_____|\_/|___|_|_|_| |_____|_|___|_| |___|_|_|___|_| |___|
____ _ ____
| \ ___ _ _ | |_ _ _ | \ ___ _ _
| | | .'| | | | . | | | | | | .'| | |
|____/|__,|_ | |___|_ | |____/|__,|_ |
|___| |___| |___|
*/
// Obtener todos los botones con la clase "calendar-dates-day"
var buttons = document.querySelectorAll('.calendar-dates-day');
// Obtener el elemento con la clase "calendar-title-text"
var titleElement = document.querySelector('.calendar-title-text');
// Función que se encarga de agregar el listener a los botones
function addListeners() {
// Obtener el texto del elemento "calendar-title-text"
var titleText = titleElement.innerText;
// Dividir el texto en el primer guión y obtener el mes y el año
var [monthText, yearText] = titleText.split('-');
// Traducir el mes de texto a número
const months = ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'];
const monthIndex = months.findIndex((month) => month.toLowerCase() === monthText.trim().toLowerCase());
const month = monthIndex + 1;
// Iterar sobre todos los botones y agregar un listener de clic
buttons.forEach((button) => {
button.addEventListener('click', () => {
console.log(`Día: ${button.innerText}, Mes: ${month}, Año: ${yearText.trim()}`);
});
});
}
// Función que se encarga de remover el listener a los botones
function removeListeners() {
buttons.forEach((button) => {
button.removeEventListener('click', () => {});
});
}
// Obtener los botones del grupo de botones del calendario
var prevMonthButtonL = document.getElementById('prevMonth');
var HoyButton = document.getElementById('today');
var nextMonthButtonR = document.getElementById('nextMonth');
// Agregar listeners a los botones del grupo de botones del calendario
prevMonthButtonL.addEventListener('click', () => {
removeListeners();
setTimeout(() => {
addListeners();
}, 1000);
});
HoyButton.addEventListener('click', () => {
removeListeners();
setTimeout(() => {
addListeners();
}, 1000);
});
nextMonthButtonR.addEventListener('click', () => {
removeListeners();
setTimeout(() => {
addListeners();
}, 1000);
});
// Agregar el listener inicialmente
addListeners();
Also see: Tab Triggers