Foros aprenderaprogramar.com

Aprender a programar => Aprender a programar desde cero => Mensaje iniciado por: Dimitar Stefanov en 12 de Enero 2016, 15:45

Título: colores CSS equivalencias entre notación hexadecimal rgb y nombres CU01019D#
Publicado por: Dimitar Stefanov en 12 de Enero 2016, 15:45
El ejercicio CU01019D me ha quedado como sigue:

Código HTML:

Código: [Seleccionar]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="keywords" content="Portal web aprenderaprogramar.com">
<meta name="description" content="aprender,programar,cursos">
<link rel="stylesheet" type="text/css" href="estilos21.css">
<title>Ejemplo colores</title>
</head>
<body>
<div id="page">
<div id="header">
</div>
<div id="wrapper">
<div id="menu">
</div>
<div id="body">
<table>
<tr>
<th>Nombre</th>
<th>Hexadecimal</th>
<th>RGB</th>
</tr>
<tr>
<td>DimGray</td>
<td>696969</td>
<td>105,105,105</td>
</tr>
<tr>
<td>IndianRed</td>
<td>CD5C5C</td>
<td>205,92,92</td>
</tr>
<tr>
<td>FireBrick</td>
<td>B22222</td>
<td>178,34,34</td>
</tr>
<tr>
<td>DodgerBlue</td>
<td>1E90FF</td>
<td>30,144,255</td>
</tr>
<tr>
<td>Indigo</td>
<td>4B0082</td>
<td>75,0,130</td>
</tr>
</table>
</div>
</div>
<div id="footer">
</div>
</div>
</body>
</html>

Código CSS: "estilos21.css"

Código: [Seleccionar]
table, td, th  {
border: 2px solid;
}
tr:nth-child(2) {
background-color: rgb(178, 34, 34);
}
tr:nth-child(3) {
background-color: rgb(205, 92, 92);
}
tr:nth-child(4) {
background-color: rgb(30, 144, 255);
}
tr:nth-child(5) {
background-color: rgb(75, 0, 130);
}
tr:last-child {
background-color: rgb(105, 105, 105);
}
Título: Re:colores CSS equivalencias entre notación hexadecimal rgb y nombres CU01019D
Publicado por: Ogramar en 14 de Enero 2016, 16:03
Buenas dimiste

Tienes errores en el ejercicio, por ejemplo el color FireBrick es un color rojizo y con tu código se ve azul

Por otra parte, la idea del ejercicio es que se apliquen colores usando las tres notaciones y comprobar que los tres se ven igual, no escribirlo de una sola manera (tú lo has escrito de una sola manera, usando rgb)

Tendrías que aplicar 15 estilos de background-color, tres por cada fila, y comprobar que los tres se ven igual al ser equivalentes.

Salu2
Título: Re:colores CSS equivalencias entre notación hexadecimal rgb y nombres CU01019D
Publicado por: Dimitar Stefanov en 15 de Enero 2016, 18:10
Buenas Ogramar,

He corregido el código CSS. Creo que quedará algo así:

Código: [Seleccionar]
table, td, th  {
border: 2px solid;
}
#tr1 td:first-child {
background-color: DimGray;
}
#tr1 td:nth-child(2) {
background-color: #696969;
}
#tr1 td:last-child {
background-color: rgb(105, 105, 105);
}
#tr2 td:first-child {
background-color: IndianRed;
}
#tr2 td:nth-child(2) {
background-color: #CD5C5C;
}
#tr2 td:last-child {
background-color: rgb(205, 92, 92);
}
#tr3 td:first-child {
background-color: FireBrick;
}
#tr3 td:nth-child(2) {
background-color: #B22222;
}
#tr3 td:last-child {
background-color: rgb(178, 34, 34);
}
#tr4 td:first-child {
background-color: DodgerBlue;
}
#tr4 td:nth-child(2) {
background-color: #1E90FF;
}
#tr4 td:last-child {
background-color: rgb(30, 144, 255);
}
#tr5 td:first-child {
background-color: Indigo;
}
#tr5 td:nth-child(2) {
background-color: #4B0082;
}
#tr5 td:last-child {
background-color: rgb(75, 0, 130);
}

He acertado?
Título: Re:colores CSS equivalencias entre notación hexadecimal rgb y nombres CU01019D
Publicado por: Alex Rodríguez en 20 de Enero 2016, 09:04
Hola dimiste, he intentado mirarlo pero falta el código html.

Saludos
Título: Re:colores CSS equivalencias entre notación hexadecimal rgb y nombres CU01019D
Publicado por: Dimitar Stefanov en 22 de Enero 2016, 00:50
Bueans,

Alex.

Tienes razón, no sé en que estaría pensando. jeje. A continuación corrijo el despiste

Código HTML:

Código: [Seleccionar]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="keywords" content="Portal web aprenderaprogramar.com">
<meta name="description" content="aprender,programar,cursos">
<link rel="stylesheet" type="text/css" href="estilos21.css">
<title>Ejemplo colores</title>
</head>
<body>
<div id="page">
<div id="header">
</div>
<div id="wrapper">
<div id="menu">
</div>
<div id="body">
<table>
<tr>
<th>Nombre</th>
<th>Hexadecimal</th>
<th>RGB</th>
</tr>
<tr id="tr1">
<td>DimGray</td>
<td>696969</td>
<td>105,105,105</td>
</tr>
<tr id="tr2">
<td>IndianRed</td>
<td>CD5C5C</td>
<td>205,92,92</td>
</tr>
<tr id="tr3">
<td>FireBrick</td>
<td>B22222</td>
<td>178,34,34</td>
</tr>
<tr id="tr4">
<td>DodgerBlue</td>
<td>1E90FF</td>
<td>30,144,255</td>
</tr>
<tr id="tr5">
<td>Indigo</td>
<td>4B0082</td>
<td>75,0,130</td>
</tr>
</table>
</div>
</div>
<div id="footer">
</div>
</div>
</body>
</html>

Código CSS: "estilos21.css"

Código: [Seleccionar]
body{font-size:36px;}

table, td, th  {
border: 2px solid;
}
#tr1 td:first-child {
background-color: DimGray;
}
#tr1 td:nth-child(2) {
background-color: #696969;
}
#tr1 td:last-child {
background-color: rgb(105, 105, 105);
}
#tr2 td:first-child {
background-color: IndianRed;
}
#tr2 td:nth-child(2) {
background-color: #CD5C5C;
}
#tr2 td:last-child {
background-color: rgb(205, 92, 92);
}
#tr3 td:first-child {
background-color: FireBrick;
}
#tr3 td:nth-child(2) {
background-color: #B22222;
}
#tr3 td:last-child {
background-color: rgb(178, 34, 34);
}
#tr4 td:first-child {
background-color: DodgerBlue;
}
#tr4 td:nth-child(2) {
background-color: #1E90FF;
}
#tr4 td:last-child {
background-color: rgb(30, 144, 255);
}
#tr5 td:first-child {
background-color: Indigo;
}
#tr5 td:nth-child(2) {
background-color: #4B0082;
}
#tr5 td:last-child {
background-color: rgb(75, 0, 130);
}

Gracias por la atención.

Atentamente,

dimiste
Título: Re:colores CSS equivalencias entre notación hexadecimal rgb y nombres CU01019D
Publicado por: Alex Rodríguez en 26 de Enero 2016, 09:06
Lo he revisado y lo veo muy bien, buen trabajo.

Saludos