{"id":80,"date":"2024-05-20T22:08:00","date_gmt":"2024-05-20T20:08:00","guid":{"rendered":"https:\/\/blog.sutilweb.eu\/?page_id=80"},"modified":"2024-05-20T22:08:00","modified_gmt":"2024-05-20T20:08:00","slug":"11-colores-en-html5","status":"publish","type":"page","link":"https:\/\/sutilweb.eu\/index.php\/lenguajes\/html5\/html5-manual\/11-colores-en-html5\/","title":{"rendered":"11. Colores en HTML5"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Los <strong>colores HTML<\/strong> se especifican con nombres de colores predefinidos o con valores <strong>RGB<\/strong>, <strong>HEX<\/strong>, <strong>HSL<\/strong>, <strong>RGBA<\/strong> o <strong>HSLA<\/strong>. En <strong>HTML<\/strong>, se puede especificar un color mediante el uso de un nombre de color:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"799\" height=\"213\" src=\"https:\/\/blog.sutilweb.eu\/wp-content\/uploads\/2024\/05\/Colores-en-HTML5.png\" alt=\"\" class=\"wp-image-81\" srcset=\"https:\/\/sutilweb.eu\/wp-content\/uploads\/2024\/05\/Colores-en-HTML5.png 799w, https:\/\/sutilweb.eu\/wp-content\/uploads\/2024\/05\/Colores-en-HTML5-300x80.png 300w, https:\/\/sutilweb.eu\/wp-content\/uploads\/2024\/05\/Colores-en-HTML5-768x205.png 768w\" sizes=\"auto, (max-width: 799px) 100vw, 799px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Color de fondo<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Puede establecer el color de fondo para los elementos HTML.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;h1&nbsp;style=\"background-color:DodgerBlue;\"&gt;Hola Mundo&lt;\/h1&gt;\n&lt;p&nbsp;style=\"background-color:Tomato;\"&gt;Lorem ipsum...&lt;\/p&gt;<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Color de texto<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Puedes establecer el color del texto.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Ejm<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;h1&nbsp;style=\"color:Tomato;\"&gt;Hola Mundo&lt;\/h1&gt;\n&lt;p&nbsp;style=\"color:DodgerBlue;\"&gt;Lorem ipsum...&lt;\/p&gt;\n&lt;p&nbsp;style=\"color:MediumSeaGreen;\"&gt;Ut wisi enim...&lt;\/p&gt;<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Color del borde<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Puedes establecer el color del borde.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Ejm<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;h1&nbsp;style=\"border:2px solid Tomato;\"&gt;Hello World&lt;\/h1&gt;\n&lt;h1&nbsp;style=\"border:2px solid DodgerBlue;\"&gt;Hello World&lt;\/h1&gt;\n&lt;h1&nbsp;style=\"border:2px solid Violet;\"&gt;Hello World&lt;\/h1&gt;<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Valor de los colores<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">En HTML, los colores tambi\u00e9n se pueden especificar mediante valores <strong>RGB<\/strong>, valores <strong>HEX<\/strong>, valores <strong>HSL<\/strong>, valores <strong>RGBA<\/strong> y valores <strong>HSLA<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Los siguientes tres elementos <strong><em>&lt;div&gt;<\/em><\/strong> tienen su color de fondo establecido con valores <strong>RGB<\/strong>, <strong>HEX<\/strong> y <strong>HSL<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"799\" height=\"223\" src=\"https:\/\/blog.sutilweb.eu\/wp-content\/uploads\/2024\/05\/Valor-de-los-colores-en-HTML5.png\" alt=\"\" class=\"wp-image-82\" srcset=\"https:\/\/sutilweb.eu\/wp-content\/uploads\/2024\/05\/Valor-de-los-colores-en-HTML5.png 799w, https:\/\/sutilweb.eu\/wp-content\/uploads\/2024\/05\/Valor-de-los-colores-en-HTML5-300x84.png 300w, https:\/\/sutilweb.eu\/wp-content\/uploads\/2024\/05\/Valor-de-los-colores-en-HTML5-768x214.png 768w\" sizes=\"auto, (max-width: 799px) 100vw, 799px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Los siguientes dos elementos <strong><em>&lt;div&gt;<\/em><\/strong> tienen su color de fondo establecido con valores <strong>RGBA<\/strong> y <strong>HSLA<\/strong>, lo que agrega un <strong>canal alfa<\/strong> al color (aqu\u00ed tenemos un 50 % de transparencia):<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"779\" height=\"160\" src=\"https:\/\/blog.sutilweb.eu\/wp-content\/uploads\/2024\/05\/Colores-en-HTML5-3.png\" alt=\"\" class=\"wp-image-83\" srcset=\"https:\/\/sutilweb.eu\/wp-content\/uploads\/2024\/05\/Colores-en-HTML5-3.png 779w, https:\/\/sutilweb.eu\/wp-content\/uploads\/2024\/05\/Colores-en-HTML5-3-300x62.png 300w, https:\/\/sutilweb.eu\/wp-content\/uploads\/2024\/05\/Colores-en-HTML5-3-768x158.png 768w\" sizes=\"auto, (max-width: 779px) 100vw, 779px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Ejm<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;h1&nbsp;style=\"background-color:rgb(255, 99, 71);\"&gt;...&lt;\/h1&gt;\n&lt;h1&nbsp;style=\"background-color:#ff6347;\"&gt;...&lt;\/h1&gt;\n&lt;h1&nbsp;style=\"background-color:hsl(9, 100%, 64%);\"&gt;...&lt;\/h1&gt;\n\n&lt;h1&nbsp;style=\"background-color:rgba(255, 99, 71, 0.5);\"&gt;...&lt;\/h1&gt;\n&lt;h1&nbsp;style=\"background-color:hsla(9, 100%, 64%, 0.5);\"&gt;...&lt;\/h1&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Los colores HTML se especifican con nombres de colores predefinidos o con valores RGB, HEX, HSL, RGBA o HSLA. En HTML, se&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":41,"menu_order":10,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_uag_custom_page_level_css":"","footnotes":""},"class_list":["post-80","page","type-page","status-publish","hentry"],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"Sutil Web","author_link":"https:\/\/sutilweb.eu\/index.php\/author\/sutilweb\/"},"uagb_comment_info":0,"uagb_excerpt":"Los colores HTML se especifican con nombres de colores predefinidos o con valores RGB, HEX, HSL, RGBA o HSLA. En HTML, se...","_links":{"self":[{"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/pages\/80","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/comments?post=80"}],"version-history":[{"count":1,"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/pages\/80\/revisions"}],"predecessor-version":[{"id":84,"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/pages\/80\/revisions\/84"}],"up":[{"embeddable":true,"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/pages\/41"}],"wp:attachment":[{"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/media?parent=80"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}