Documentos de Académico
Documentos de Profesional
Documentos de Cultura
ÍNDICE
1. CAPÍTULO 01..................................................................................................................................................4
1.1. TRES MANERAS DE INSERTAR HOJAS DE ESTILO.....................................................................................4
1.2. SELECTORES............................................................................................................................................4
1.2.1. SELECTOR DESCENDIENTE INNECESARIA........................................................................................5
1.2.2. LLAMADO DE UN SELECTOR DE FORMA CORRECTA.............................................................................5
1.3. TIPOS DE DATOS.....................................................................................................................................5
1.4. VARIABLES Y HERENCIAS........................................................................................................................6
1.5. ESTILOS DE TEXTOS.................................................................................................................................6
2. CAPÍTULO 02..................................................................................................................................................8
2.1. SECTORES EN CSS....................................................................................................................................8
/* Selectores de tipo etiqueta HTML*/..........................................................................................................8
/* Selectores de tipo Id*/...............................................................................................................................8
/* Selectores de clases (recomendados)*/.....................................................................................................8
ESPECIFICIDAD................................................................................................................................................8
2.2. SELECTORES DE ATRIBUTOS....................................................................................................................9
2.3. SELECTORES COMPUESTOS..................................................................................................................10
/* CONCEPTO DE SELECTORES COMPUESTOS*/...........................................................................................10
2.4. PSEUDO CLASE EN FORMULARIOS........................................................................................................11
/* Pseudo clases de formularios */..............................................................................................................12
2.5. PSEUDO CLASE CHILD...........................................................................................................................13
2.6. PSEUDO CLASE TYPE.............................................................................................................................14
/* Concepto Pseudo Clase type */................................................................................................................14
2.7. PSEUDO CLASES....................................................................................................................................14
/* CONCEPTO PSEUDO CLASES.................................................................................................................15
3. CAPITULO 03.................................................................................................................................................17
3.1. SELECTORES AGRUPADOS.....................................................................................................................17
3.2. INLINE BLOCK........................................................................................................................................17
3.3. MARGIN AND PADDING........................................................................................................................18
3.4. BORDER................................................................................................................................................19
3.5. DIMENSIONES DE LA CAJA BOX SIZING.................................................................................................19
3.6. BORDER-RADIUS...................................................................................................................................20
3.7. BACKGROUND......................................................................................................................................20
3.8. PSEUDO ELEMENTOS............................................................................................................................21
TALLER DE PROGRAMACIÓN WEB
VISTA............................................................................................................................................................34
5.3. ALINEAR EN EJE (AXIS)..........................................................................................................................34
HTML............................................................................................................................................................34
CSS................................................................................................................................................................35
VISTA............................................................................................................................................................35
5.4. ALINEAR EN EJE SECUNDARIO (AXIS)...................................................................................................35
HTML............................................................................................................................................................35
CSS................................................................................................................................................................36
ISTA...............................................................................................................................................................36
5.5. CAJA FLEX BOX......................................................................................................................................37
HTML............................................................................................................................................................37
CSS................................................................................................................................................................37
VISTA............................................................................................................................................................38
5.6. DISEÑO DE UNA PÁGINA ADECUADAMENTE CON FLEX.......................................................................38
HTML............................................................................................................................................................38
CSS................................................................................................................................................................38
VISTA............................................................................................................................................................39
5.7. MENÚ ANIMADO CON FLEX..................................................................................................................39
HTML............................................................................................................................................................39
CSS................................................................................................................................................................39
VISTA............................................................................................................................................................40
TALLER DE PROGRAMACIÓN WEB
1. CAPÍTULO 01
1.1. TRES MANERAS DE INSERTAR HOJAS DE ESTILO
Index.html
<!DOCTYPE html>
<html lang="en">
<head>
<!--==== Tres maneras de agrega estilos CSS ====-->
<meta charset="UTF-8">
<style>
<!--==== 02 Metodo ====-->*/
/* here code /*CSS*/
</style>
</head>
<body>
<!--==== 03 Metodo ====-->
<h1 style="background: rgba(200, 100, 255, 0.5); color: #fff; width:
60%; text-align: center;">Introducción a CSS</h1>
</body>
</html>
1.2. SELECTORES
Styles.css
INTRODUCCIÓN Y RECURSOS EN CSS
:root{
}
body{ /* body selector de etiqueta */
background: #BDBDBD;
}
body span{/* selector descendientes*/
font-size: 60px;
color: blue;
}
1.2.1. SELECTOR DESCENDIENTE INNECESARIA
/*
body header h1 span{
color: green;
}
*/
1.2.2. LLAMADO DE UN SELECTOR DE FORMA CORRECTA
h1{
background: black;
font-size: 50px;
font-family: seans-serif;
text-decoration: underline;
color: white;
}
h1:nth-of-type(2) {
color: yellow;
}
tiposDatos.css
/*Tipos de datos*/
header span{
color:red;
color:hsl(0,100%,50%);
color: rgb(255,0,0);
color:#ff0000;
color:1s;/*DATO INCORRECTO NO MUESTRA EL ERROR DE DEBUG*/
}
header span{
pág. 5
INTRODUCCIÓN Y RECURSOS EN CSS
variablesHerencias.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Variables y Herencias</title>
<link rel="stylesheet" href="css/variablesHerencias.css">
</head>
<body>
<h1>Variables y <span>Herencias en </span>CSS</h1>
</body>
</html>
variablesHerencias.css
/*Variables y Heerencias*/
:root{
--jpmcolor:green;
}
body{
background:var(--jmpcolor);
}
body span{
color:grey;
estilotexto.html
<!DOCTYPE html>
<html lang="en">
pág. 6
INTRODUCCIÓN Y RECURSOS EN CSS
<head>
<meta charset="UTF-8">
<title>Estilos para Textos y estilo por defecto</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300"
rel="stylesheet">
<link rel="stylesheet" href="css/estiloTexo.css">
</head>
<body>
<h1>Estilos para un texto</h1>
<h1>Estilos por defecto</h1>
<nav>
<ul>
<li>Item01</li>
<li>Item02</li>
<li>Item03</li>
<li>Item04</li>
</ul>
</nav>
</body>
</html>
estiloTexto.css
body{
margin:0;
}
h1{
color: green;
font-size: 50px;
font-family: sans-serif;
font-family: Arial, serif;/*full-back*/
font-family: 'Open Sans Condensed', sans-serif;
line-height: 10px;/*Interlineado*/
}
nav ul li{
text-align: center;
color: skyblue;
}
/*font-family: monospace;*/
pág. 7
INTRODUCCIÓN Y RECURSOS EN CSS
2. CAPÍTULO 02
En este capítulo ampliaremos el tema de selectores en CSS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="css/selectoresCSS.css">
</head>
<body>
<ul>
<li class="menu-01" id="pri" >Item01</li>
<li class="menu-item red">Item02</li>
<li class="algo3">Item03</li>
<li class="algo4">Item04</li>
<li class="algo5">Item05</li>
</ul>
</body>
</html>
#pri{
background: rgba(205,200,100);
}
/* Selectores de clases (recomendados)*/
.menu-item{
background: lime;
}
.menu-item{
background: red !important;
}
.red{
background: green !important;
}
/*
ESPECIFICIDAD
Es un algoritmo de CSS por el cual se resuelven los conflictos de estilos.
type 1
class 10
id 100
inline 1000
!important Superior a los demas
pág. 8
INTRODUCCIÓN Y RECURSOS EN CSS
*/
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Selectores de Atributos</title>
<link rel="stylesheet" href="css/selectoresAtributos.css">
</head>
<body>
<a href="https://google.com">Ir a google</a>
<a href="https://facebook.com" title="facebook">Ir a facebook</a>
<a href="http://youtube.com">Ir a youtube</a>
<span title="span">Selectores de atributos</span>
<a href="resultadoPdf.docx">Descargue los resultados</a>
</body>
</html>
[href="https://facebook.com"]{
color:blueviolet;
font-size: 20px;
}
[href="https://facebook.com"]{
color:blueviolet;
font-size: 20px;
}
/*Selector combinado*/
[href][title]{
color:aqua;
font-size: 2em;
}
pág. 9
INTRODUCCIÓN Y RECURSOS EN CSS
}
/* Comodin * (contiene) */
[href*="pdf" i]{
background:
url(http://icons.iconarchive.com/icons/hopstarter/software/32/Microsoft-Word-
icon.png) left / contain no-repeat;
padding-left: 1.5em;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Selectores Compuestos</title>
<link rel="stylesheet" href="css/selecoresCompuestos.css">
</head>
<body>
<ul>
<li><span>Item01</span></li>
<li>Item02</li>
<li>Item03</li>
<li>Item04</li>
</ul>
<section>
<h1 class="second title" >Selector adyacente</h1>
<p class="second" >Lorem ipsum dolor sit amet, consectetur adipisicing
elit. Labore, voluptates!</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Odit,
porro.</p>
<p>Lorem ipsum dolor sit amet.</p>
</section>
<input type="text" placeholder="">
</body>
</html>
padre hijo{
style
}
Algo mejor
ancestro descendiente{
style
}
*/
/* Hijos directos
ul>span{
pág. 10
INTRODUCCIÓN Y RECURSOS EN CSS
background: red;
} la forma correcta es:
*/
ul>li>span{
color:coral;
}
/*Combinar selectores*/
/* esto no es adecuado
.second{
color:green;
} */
/*esto es correcto*/
.second.title{
color:green;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Pseudo Clase en Formularios</title>
<link rel="stylesheet" href="css/psudocodicoFormularios.css">
</head>
<body>
<form action="get">
<input disabled type="text">
<input type="text">
<input required type="text">
<input class="selection" type="radio" id="opcion-01">
<label for="opcion-01">Opcion 01</label>
<input type="email" id="email">
<input type="number" max="20">
</body>
</html>
pág. 11
INTRODUCCIÓN Y RECURSOS EN CSS
/* checked */
.selection:checked + label{
font-size: 2em;
background: chocolate;
color: white;
}
/* :required :optional */
input:optional{
border: 1px solid green;
}
form :required{
border: 1px solid red;
}
/* :valid :invalid */
#email:valid{
background: yellow;
}
#email:invalid{
background: red;
}
/* :in-range :out-of-range*/
:in-range{
background: blue;
pág. 12
INTRODUCCIÓN Y RECURSOS EN CSS
}
:out-of-range{
background: red;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>PSEUDOCLASES CHILD</title>
<link rel="stylesheet" href="css/pseudoClaseChild.css">
</head>
<body>
<div>
<p>Parrafo 1</p>
<p>Parrafo 2</p>
<p>Parrafo 3</p>
<p>Parrafo 4</p>
<p>Parrafo 5</p>
</div>
<div class="item-color">
<div>Div 1</div>
<div>Div 2</div>
<p>Item 1</p>
<p>Item 2</p>
<p>Item 3</p>
<p>Item 4</p>
<p>Item 5</p>
</div>
</body>
</html>
/* PSEUDOCLASE CHILD */
p:first-child{
background: coral;
}
p:last-child{
background: cyan;
}
/* Puede ser p:nth-child(3n) ó p:nth-child(3n+1) ó p:nth-child(even) pares , p:nth-
child(odd) inpares */
p:nth-child(3){
background: blue;
color:darkgreen;
}
/* contar al revez */
p:nth-last-child(2n){
background: blue;
color:darkgreen;
}
pág. 13
INTRODUCCIÓN Y RECURSOS EN CSS
.item-color p:nth-child(3){
background: red;
color: white;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Pseudo Clase type</title>
<link rel="stylesheet" href="css/psudoClasesType.css">
</head>
<body>
<div class="menu-item">
<p class="parrafo">Parrafo 1</p>
<p class="parrafo">Parrafo 2</p>
<p class="parrafo">Parrafo 3</p>
<p class="parrafo">Parrafo 4</p>
<p class="parrafo">Parrafo 5</p>
<p class="parrafo">Parrafo 6</p>
</div>
</body>
</html>
/* Concepto Pseudo Clase type */
/* :first-child :first-of-type */
/* :last-child :last-of-type */
/* :nth-child() :nth-of-type(n) */
.parrafo:nth-of-type(4){
background: red;
color:aqua;
}
p:nth-of-type(4){
background: coral;
color:white;
}
<!DOCTYPE html>
pág. 14
INTRODUCCIÓN Y RECURSOS EN CSS
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Pseudo Clases</title>
<link rel="stylesheet" href="css/psedudoClases.css">
</head>
<body>
<nav>
<a href="Youtube">Youtube</a>
<a href="#parrafo">Ir Parrafo</a>
</nav>
<div id="parrafo">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quaerat,
architecto!</p>
</div>
<a class="buttom" href="#">Ir Google</a>
<span>Artículo 01</span>
<span></span>
<span>Artículo 03</span>
</body>
</html>
pág. 15
INTRODUCCIÓN Y RECURSOS EN CSS
position: fixed;
width: 100%;
height: 50px;
top: 0;
}
nav a{
padding: 0 0.5em;
color:seashell;
display: inline;
text-align: center;
line-height: 50px;
text-decoration: none;
}
#parrafo{
margin-top: 50em;
margin-bottom: 50em;
}
#parrafo:target{
padding-top: 50px;
}
/* Enlaces Root */
/* hace referencia a html */
:root{
background: #D8D8D8;
}
/* Enlace empty */
span{
display: block;
padding: 0.5em;
background: chocolate;
}
span:empty{
display:none;
padding: 0;
}
pág. 16
INTRODUCCIÓN Y RECURSOS EN CSS
3. CAPITULO 03
3.1. SELECTORES AGRUPADOS
HTML
<link rel="stylesheet" href="css/01selectoresAgrupados.css">
<h1 class="titulo">hola Mundo</h1>
<p class="welcome">Bienvenidos a mi web</p>
CSS
/* Selectores agrupados */
/* .titulo{
text-decoration: underline;
color:red;
}
.welcome{
text-decoration: underline;
color:blue;
} */
/* válido */
.titulo,
.welcome{
text-decoration: underline;
}
.titulo{
color:aqua;
}
.welcome{
color:chocolate;
}
CSS
h1{
background: coral;
pág. 17
INTRODUCCIÓN Y RECURSOS EN CSS
height:50px;
}
a:nth-of-type(2){
/* display: inline-block; */
color:white;
background: darkcyan;
height: 50px;
}
/* Lo mejor de inline: Se ajusta al contenido
Lo mejor de block: Tiene Height y width; */
NOTA 1
NOTA 2
HTML
<link rel="stylesheet" href="css/04MarginPadingColapsado.css">
<div class="elemento">Lorem ipsum dolor sit amet.</div>
<div class="elemento">Lorem ipsum dolor sit amet.</div>
CSS
.elemento{
background: coral;
padding: 10px;
display: block;
/* display: block; Colapso de margen se utiliza el margen demaryor tamaño*/
/* padding: 20px 100px 60px 10px; */
/* padding: 20px 100px; */
/* padding-top:; padding-right: ; padding-bottom: ; padding-left: ; */
margin:20px;
}
/* body{
background: #0ff0ff
}
h1{
background: yellow;
} */
pág. 18
INTRODUCCIÓN Y RECURSOS EN CSS
3.4. BORDER
HTML
<link rel="stylesheet" href="css/05bordes.css">
<div class="caja">Hola Rene</div>
CSS
/* .caja{
width:200px;
height:100px;
border-color: red;
border-style:dashed; dotted, solid, dashed,
text-align: center; */
/* .caja{
width: 100px;
height:50px;
border: 1px dashed red;
border-bottom: none;
} */
.caja{
width:200px;
height:100px;
border-color:aliceblue red coral green;
border-style: dashed;
border-width: 2px 5px 12px 20px;
border-left: 10px double green;
}
HTML
<link rel="stylesheet" href="css/05DimensionesCaja-Box-sizing.css">
<div class="caja">
hola
</div>
CSS
*,
pág. 19
INTRODUCCIÓN Y RECURSOS EN CSS
*:before,
*:after{
box-sizing: border-box;
}
.caja{
width: 276px;
height: 176px;
border: 2px solid coral;
padding:10px;
}
3.6. BORDER-RADIUS
HTML
<link rel="stylesheet" href="css/06BorderRadio.css">
<link rel="icon" href="img/logo%20ci.png">
<div class="caja">
Rene Inca
</div>
CSS
.caja{
width:200px;
height:100px;
border: 6px double coral;
box-sizing:border-box;
/* border-radius:12%;
border-bottom-right-radius: 50%; */
border-radius: 15% 25% 50% 100%;
}
3.7. BACKGROUND
HTML
<link rel="stylesheet" href="css/07Background.css">
<div class="caja">...</div>
CSS
.caja{
box-sizing: border-box;
width: 400px;
height: 400px;
/* background: red; */
background-image: url(../img/logo.png),url(../img/css.png);
background-color: lightcoral;
background-repeat: no-repeat, repeat;
background-size: 50%, 18%;
background-position: center,left top;
}
pág. 20
INTRODUCCIÓN Y RECURSOS EN CSS
HTML
<link rel="stylesheet" href="css/08Background.css">
<link rel="icon" href="img/logo.png">
<div class="caja"></div>
<div class="gear"></div>
CSS
.caja{
box-sizing: border-box;
width:400px;
height:400px;
border: 20px dashed coral;
background: url(../img/dibujo.png),url(../img/Perro.jpg),chocolate;
background-repeat: no-repeat;
background-position: center,center;
background-size: 50%, cover;
background-clip: border-box; /*me indica el lugar a mostrarse ya se a
conten-box , padding-box*/
background-origin: border-box;
}
.gear{
width: 200px;
height:200px;
background: grey;
border-radius: 50%;
border: 35px dashed grey;
background-clip: padding-box;
}
CSS
/* los Pseudo elementos no existen en el HTML */
/* .title::before{
content: "Hola";
}
.title::after{
content: " Mundo"
} */
.title::before{
pág. 21
INTRODUCCIÓN Y RECURSOS EN CSS
}
.download{
display: block;
text-decoration:none;
margin-bottom: 1em;
}
[href$="pdf"]::before{
content: url(../img/pdf.png);
display: inline-block;
}
[href*="doc"]::before{
content: url(../img/word.png)
}
[href*="xls"]::before{
content: url(../img/excel.png)
}
.download::before{
margin-right: 3px;
display: inline-block;
}
<article class="art">
<h1>Lorem ipsum dolor sit amet.</h1>
<img src="img/Perro.jpg" alt="" class="img" height="200" width="300">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Rerum veritatis
quae illum, magnam atque libero, vitae totam quaerat. Autem, voluptatibus
corporis necessitatibus deserunt eos sequi praesentium quam ratione, illo,
asperiores fuga incidunt expedita ad architecto nam vero voluptates rem
temporibus. Magni vitae repudiandae aliquam ab debitis voluptatibus nisi
voluptate excepturi.</p>
pág. 22
INTRODUCCIÓN Y RECURSOS EN CSS
6. print('HTTP OR HTTPS',resultado.geturl())
</code>
</pre>
</article>
CSS
/* FLOAT Y OVERFLOW */
.img{
float: left;
margin: 0 10px 0 10px;
.art{
width:60%;
margin: auto;
border: 1px dashed blue;
overflow:scroll; /* hidden | scroll | auto */
}
.art::after{
content: '';
display: block;
height: 300px;
width: 300px;
background: coral;
margin-left: -100px;
}
.code-python{
width: 360px;/* width: 100%;*/
border: 2px solid gray;
overflow: auto; /* overflow-x ||overflow-y */
}
pág. 23
INTRODUCCIÓN Y RECURSOS EN CSS
4. CAPITULO 04
<h1>Título</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Atque accusantium,
velit tempore ex adipisci accusamus nostrum dolores eligendi assumenda ducimus
porro eos quas quisquam nihil est esse rem temporibus eum itaque, repellat eaque
explicabo. Quam iste consectetur, velit eos asperiores.</p>
CSS
/* que es un elemento posicionado */
/* propiedad position:static =>| relative | absolute | fixed | sticky;
Cuando un elemento está posicionado, se sale del flujo. Además adquiere nuevas
propiedades:
top
right
bottom
left
z-index
*/
/* h1{
position: absolute;
} */
h1{
background: yellow;
display: inline-block;
}
p{
background: pink;
margin-top: -50px;
z-index:inherit;
}
4.2. FLUJO RELATIVO
HTML
<link rel="stylesheet" href="css/01PositionRelative.css">
<div class="content-style">
<h1>Position Relative</h1>
</div>
<p>Lorem100p>
pág. 24
INTRODUCCIÓN Y RECURSOS EN CSS
CSS
/* POSITION RELATIVE
1. El elemto conserva su espacio en el flujo (No se nota el cambio).
2. Conserva sus dimensiones originales.
3. Su contexto su posición inicial.
4. El espacio dejado se conserva. */
h1{
background: yellow;
margin: 0;
border: 1px solid green;
position: relative;
/* Adquiere las cinco propiedades .. Su contexto es su posicion inicial*/
top: 20px; /* 20px del top del contexto div */
right: 30px;/* 30px del right del contexto div */
/* Si utilizamos top y bottom ; left y right
El resultado seria top > bottom y left > right */
}
.content-style{
border: 4px dashed coral;
}
HTML
<link rel="stylesheet" href="css/02PositionAbsolute.css">
<div class="poster">
<img src="img/Perro.jpg" alt="peroo">
<p class="caption-style">RAZA SIBERIANO</p>
</div>
CSS
/* POSITION ABSOLUTE
1. El elemeto No conserva su espacio en el flujo;
2. Sus dimensiones se adaptan al contenido
3. Su contexto es su ancestro posicionado mas cercano
*/
.poster{
pág. 25
INTRODUCCIÓN Y RECURSOS EN CSS
width: 500px;
margin: 0;
position:absolute;/* absolute; padre del .caption */
}
.poster img{
width: 100%;
display: block;
}
.caption-style{
position: absolute;
color: white;
margin:0;
background: rgba(0,0,0,.2);
width: 100%;
height: 100%;
text-align: center;
font-size: 40px;
/* efecto */
top: -800px;
overflow: hidden;
transition: all .6s;
}
.poster:hover .caption-style{
top: 0;
}
pág. 26
INTRODUCCIÓN Y RECURSOS EN CSS
CSS
.menu,.menu ul{
list-style: none;
margin-top: 0;
margin-bottom: 0;
padding-left: 0;
}
.menu{
background: rgba(0,150,0,.5);
display: table;
}
.menu>li {
float: left;
}
.menu li{
position: relative;
}
.menu li:hover{
background: rgba(0,0,0,.5);
}
.menu a{
color: white;
pág. 27
INTRODUCCIÓN Y RECURSOS EN CSS
text-decoration: none;
display: block;
padding: .5em 1.5em;
white-space:nowrap;
}
.menu li>ul{
display: none;
position: absolute;
background: rgba(0,100,0,.5);
}
.menu li:hover>ul{
display: block;
animation: all 40s;
}
.menu ul ul{
background: rgba(0,50,0,.5);
top: 0;
left: 100%;
}
HTML
CSS
/* Position Fixed
pág. 28
INTRODUCCIÓN Y RECURSOS EN CSS
1. Pierde su espacio en el flujo.
2. Su contexto es el viewport.
3. Sus dimensiones se ajustan acontenido.(salvo que se haya declarado su
tamaño)
4. Se queda fijo en el viewport sin moverse con el scroll.
*/
body{
margin-bottom: 2000px;
margin-top: 50px;
}
.style-menu{
background: hsl(180,60%,60%);
padding: 1em;
text-align: center;
position: fixed;
top: 0;
width: 100%;
opacity: 0.8;
}
p{
text-align: justify;
}
img{
width: 40%;
position: fixed;
border: 10px solid hsl(180,60%,60%);
overflow: auto;
border-radius: 80% 1% 80% 80%;
opacity: 0.8;
top:50px;
right: 0;
}
4.6. MENÚ FIXED
HTML
pág. 29
INTRODUCCIÓN Y RECURSOS EN CSS
CSS
.menu-style{
position: fixed;
background: rgba(0,200,0,.9);
border: 1px solid green;
height: 100%;
width: 25%;
overflow: auto;
}
.ul-style{
list-style: none;
margin-bottom: 0;
margin-top: 0;
padding-left: 0;
}
.li-style{
line-height: 4;
display: block;
border-bottom: 1px solid green;
}
.li-style::before{
content: url(../img/excel.png);
line-height: 4;
}
.a-style{
text-decoration: none;
color: white;
padding-left: 1em;
}
.main-style{
margin-left: 27%;
}
4.7. Z-INDEX
HTML
<link rel="stylesheet" href="css/06z-index.css">
<div class="a forma">A</div>
<div class="b forma">B</div>
<div class="c forma">C</div>
CSS
.forma{
width: 200px;
height: 200px;
border-radius: 10%;
pág. 30
INTRODUCCIÓN Y RECURSOS EN CSS
line-height: 200px;
text-align: center;
font-size: 4em;
color: white;
position: relative;
}
.a{
background: hsl(100,50%,70%);;
z-index: 40;
}
.b{
background: hsl(200,50%,70%);
top: -50px;
left: 150px;
z-index: 20;
}
.c{
background: hsl(300,50%,70%);
top: -100px;
left: 300px;
z-index: 10;
}
}
pág. 31
INTRODUCCIÓN Y RECURSOS EN CSS
<nav class="menu-style">Python</nav>
<!-- (p>lorem)*40 -->
CSS
.menu-style{
background: hsl(200,80%,70%);
line-height: 50px;
text-align: center;
font-size: 35px;
color: white;
position: sticky;
top: 100px;
padding: 1em;
}
5. CAPITULO 05 FLEXBOX
5.1. FLEXBOX
HTML
<link rel="stylesheet" href="CSS/01Flexbox.css">
<div class="container">
HIJO-FLEX-01
<div class="item">HIJO-FLEX-2</div>
</div>
CSS
/* Flexbox requiere de un elemento padre y al menos de un elemento hijo */
/* el principio para trabajar con Flexbox es:
padre => flex-container
hijo => flex-item
padre{
display:flex | inline-flex ; Crea un context flex para sus hijos
*/
pág. 32
INTRODUCCIÓN Y RECURSOS EN CSS
/*
Según el valor indicado, el main axis será:
row: horizontal, izquierda a derecha
row-reverse: horizontal, derecha a izquierda
column: vertical, de arriba hacia abajo
column-reverse: vertical, de abajo hacia arriba
*/
.container{
display: flex;
background: hsl(100,50%,70%);
width:300px;
height:300px;
/* flex-direction:column-reverse; */
justify-content:space-between;
align-items:flex-start;
border-radius: 10%;
padding: 1em;
}
.item{
align-self: flex-end;
order: -1;
}
VISTA
HTML
<link rel="stylesheet" href="CSS/02DireccionEjes.css">
<!-- <div class="main-flex">
<div class="item-flex">01</div>
<div class="item-flex">02</div>
</div> -->
<div class="main-flex">
.div{$$}*40
</div>
pág. 33
INTRODUCCIÓN Y RECURSOS EN CSS
CSS
/* .main-flex{
display:flex;
flex-direction: row; column|column-reverse|row|row-reverse
} */
.main-flex{
display: flex;
/* flex-direction: row-reverse;
flex-wrap: wrap; todo esto es equivalente a: */
flex-flow: row-reverse wrap;
}
.item-flex{
background: hsl(600,50%,60%);
border-radius: 50%;
width: 1em;
padding: 1em;
color: white;
font-size: 20;
VISTA
<div class="main-flex">
<div class="item-flex">01</div>
<div class="item-flex">02</div>
<div class="item-flex">03</div>
<div class="item-flex">04</div>
<div class="item-flex">05</div>
</div>
CSS
.main-flex{
pág. 34
INTRODUCCIÓN Y RECURSOS EN CSS
display: flex;
/* flex-direction: row-reverse;
flex-wrap: wrap; todo esto es equivalente a:
flex-flow: row-reverse wrap;
*/
background: hsl(200,50%,60%);
flex-direction:row-reverse;
justify-content:flex-end; /*final*/
justify-content:center; /*centro*/
justify-content:space-around; /*Distribucion alrededor */
justify-content:space-between; /*Distribucion alrededor entre ellos*/
justify-content: flex-start; /*inicio*/
height: 40em;
width: 40em;
}
.item-flex{
background: hsl(600,50%,60%);
border-radius: 2%;
width: 1em;
padding: 1em;
color: white;
font-size: 20;
height: 1em;
width: 1em;
/* margin: auto Para centrar automaticamente*/
}
.item-flex:nth-child(even){
background: hsl(300,50%,60%);
}
.item-flex:nth-child(3){
margin-right: auto;
margin-left: auto;
}
VISTA
HTML
<link rel="stylesheet" href="CSS/04AlineacionEjeSecundarioCross.css">
<div class="main-flex">
<div class="item-flex">01</div>
<div class="item-flex">02</div>
<div class="item-flex">03</div>
<div class="item-flex">04</div>
<div class="item-flex">05</div>
pág. 35
INTRODUCCIÓN Y RECURSOS EN CSS
<div class="item-flex">06</div>
<div class="item-flex">07</div>
<div class="item-flex">08</div>
<div class="item-flex">09</div>
<div class="item-flex">10</div>
<div class="item-flex">11</div>
<div class="item-flex">12</div>
</div>
CSS
.main-flex{
display: flex;
background: hsl(200,50%,60%);
justify-content: flex-start; /*inicio*/
height: 500px;
width: 500px;
flex-direction: column;
align-items: flex-start;
}
.item-flex{
background: hsl(600,50%,60%);
border-radius: 20%;
padding: 1em;
color: white;
font-size: 20;
height: 15px;
width: 15px;
/* margin: auto Para centrar automaticamente*/
}
.item-flex:nth-child(even){
background: hsl(300,50%,60%);
}
.item-flex:nth-child(3){
margin-right: auto;
margin-left: auto;
}
ISTA
pág. 36
INTRODUCCIÓN Y RECURSOS EN CSS
HTML
<link rel="stylesheet" href="css/04CajasFlex.css">
<div class="flex-content">
<div class="flex-item">01</div>
<div class="flex-item">02</div>
<div class="flex-item">03</div>
<div class="flex-item">04</div>
<div class="flex-item">05</div>
</div>
CSS
/*
flex-basic: main-size inicial
flex-gorw: factor de crecimiento
unit grow = espacio disponible / suma de flex-grow
flex-shrink: factor de encogimiento
VISTA
pág. 37
INTRODUCCIÓN Y RECURSOS EN CSS
CSS
/*
flex-basic: main-size inicial
flex-gorw: factor de crecimiento
unit grow = espacio disponible / suma de flex-grow
flex-shrink: factor de encogimiento
pág. 38
INTRODUCCIÓN Y RECURSOS EN CSS
VISTA
CSS
*{
box-sizing: border-box;
}
.banner{
display: flex;
width: 80%;
margin-left: auto;
margin-right: auto;
height: 200px;
}
.item{
display: flex;
flex: auto;
/* border: 1px dashed coral; */
margin: 1px;
border-radius: 5%;
box-shadow:
inset 0 5px white,
inset 0-5px 0 #bbb,
inset 5px 0 #d7d7d7,
inset -5px 0 #d7d7d7;
}
pág. 39
INTRODUCCIÓN Y RECURSOS EN CSS
.item:hover{
flex: 80 0 0;
}
.item:hover span{
transform: none;
transition: all .6s;
}
.item span{
margin: auto;
text-transform: uppercase;
transform: rotate(-90deg);
color: white;
font-size: 20;
}
.item:nth-child(1){
background: hsl(120,50%,50%);
}
.item:nth-child(2){
background: hsl(200,50%,50%);
}
.item:nth-child(3){
background: hsl(50,70%,50%);
}
.item:nth-child(4){
background: hsl(400,50%,50%);
}
VISTA
pág. 40
INTRODUCCIÓN Y RECURSOS EN CSS
6. CAPITULO 06
6.1. Display Table
HTML
<link rel="stylesheet" href="css/01TableCSS.css">
<div class="table">
<h2>Titulo</h2>
<a href="#">ir</a>
</div>
<!-- <table>
<tr>
<td>Hola Mundo 01</td>
<td>Hola Mundo 01</td>
<td>Hola Mundo 01</td>
</tr>
<tr>
<td>Hola Mundeo 02</td>
<td>Hola Mundeo 02</td>
<td>Hola Mundeo 02</td>
</tr>
</table> -->
CSS
/*
se adapta al contenido
elimina float.
*/
.table{
background: yellow;
display: table;
margin-left: auto;
margin-right: auto;
padding: 1em;
}
h2{
float: left;
}
a{
float: right;
}
/* ejm 02 */
table{
background: hsl(120,50%,50%);
border:1px dashed coral;
margin:2em auto;
padding: 1em;
border-collapse: collapse;
pág. 41
INTRODUCCIÓN Y RECURSOS EN CSS
border-spacing: 10px;
table-layout: fixed;
width: 75%;
}
tr:nth-child(even){
border: 1px solid red;
background: #eee;
}
td{
border: 1px solid coral;
padding: .3em;
VISTA
6.2. Colores Hexadecimales
HTML
<link rel="stylesheet" href="css/02ColorHexadecimal.css">
<h1>Color Hexadecimal</h1>
CSS
/* 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f */
h1{
background-color: #f00;
color: #2f2;
}
VISTA
pág. 42
INTRODUCCIÓN Y RECURSOS EN CSS
VISTA
6.4. Degradado
HTML
<link rel="stylesheet" href="css/04Degradado.css">
<div class="libreta"></div>
CSS
body{
height: 100hw;
background-image: linear-gradient(to right, hsl(60,100%,85%)
98%,hsl(0,60%,45%) 98%);
background-size: 50px;
/* margin-right:
se puede usar 10deg => grados
*/
}
.libreta{
height: 50%;
width: 400px;
margin: auto;
border-radius: 10%;
background: url(../img/Perro.jpg) center / cover;
position: relative;
}
.libreta::before{
content: "";
width: 100%;
height: 100%;
background-image:radial-gradient(circle at 20px
30px,hsl(120,80%,50%) ,hsl(220,100%,50%) );
opacity: .5;
display: block;
pág. 43
INTRODUCCIÓN Y RECURSOS EN CSS
VISTA
6.5. Grid
HTML
<link rel="stylesheet" href="css/05Grid.css">
<div class="grid-container">
<div class="grid-item">1</div>
<div class="grid-item">2</div>
<div class="grid-item">3</div>
<div class="grid-item">4</div>
<div class="grid-item">5</div>
<div class="grid-item">6</div>
<div class="grid-item">7</div>
<div class="grid-item">8</div>
<div class="grid-item">9</div>
<div class="grid-item">10</div>
<div class="grid-item">11</div>
<div class="grid-item">12</div>
</div>
CSS
.grid-container{
display: grid;
grid-template-columns: 300px 200px 1fr;
grid-template-rows: 200px 150px 100px 50px;
/* grid-gap: 5px; */
grid-row-gap: 5px;
}
.grid-item{
background: hsl(120,80%,50%);
}
.grid-item:nth-child(even){
background: hsl(120,50%,50%)
}
.grid-item:nth-child(10){
/* grid-column-start: 2;
grid-column-end: 4;
grid-row-start: 1;
pág. 44
INTRODUCCIÓN Y RECURSOS EN CSS
grid-row-end: 3; */
grid-column: 2 / 4;
grid-row: 1 / span 2 /* ocupa dos columna */;
}
VISTA
CSSS
*{
box-sizing: border-box;
}
.content{
margin: 0;
display: grid;
grid-template-columns: 20% 60% 20%;
grid-template-rows: 100px 1fr 100px;
height: 100vh;
grid-template-areas: "header header header"
"asaid01 main asaid02"
"footer footer footer";
grid-gap: 10px;
width: calc(100% - 20px);
pág. 45
INTRODUCCIÓN Y RECURSOS EN CSS
header{
background: hsl(120,100%,50%);
grid-area: header;
}
asaid{
background: hsl(140,70%,50%);
}
main{
background: hsl(120,40%,50%);
grid-area: main
}
footer{
background: hsl(200,40%,50%);
grid-area: footer;
}
VISTA
pág. 46
INTRODUCCIÓN Y RECURSOS EN CSS
7. CAPITULO 07
7.1. Rotate
HTML
<link rel="stylesheet" href="css/01Transformaciones.css">
<h1>Transformación</h1>
<div class="container">
<div class="box">BOX</div>
</div>
CSS
:root{
--size: 300px;
}
.container{
width: var(--size);
height: var(--size);
border: 2px solid black;
margin: auto;
}
.box{
/* background: hsl(320,80%,50%); */
line-height: var(--size);
text-align: center;
font-size: 2em;
opacity: .8;
color: white;
transform: rotate(20deg);
width: var(--size);
height: var(--size);
background: linear-gradient(
transparent 49%,
red 49%,
red 49%,
transparent 50%
),
linear-gradient(
to left,
transparent 49%,
red 49%,
red 49%,
transparent 50%
);
border: 2px solid red;
pág. 47
INTRODUCCIÓN Y RECURSOS EN CSS
/*
transform:
scale(x,y) |scaleX()|scaleY()
translate(x,y) |translateX()|translateY()
rotate(angulo) |rotateX()|rotateY()
skew(x,y)
*/
a{
transform: scale(1.5);
transform: translate(100%,0);
transform: skewX(10deg)
}
VISTA
pág. 48