{"id":1272,"date":"2024-08-01T17:32:26","date_gmt":"2024-08-01T15:32:26","guid":{"rendered":"https:\/\/blog.sutilweb.eu\/?page_id=1272"},"modified":"2024-08-01T17:32:26","modified_gmt":"2024-08-01T15:32:26","slug":"27-links-css","status":"publish","type":"page","link":"https:\/\/sutilweb.eu\/index.php\/lenguajes\/css3\/css3-basico\/27-links-css\/","title":{"rendered":"27. Links CSS"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Con CSS, los enlaces se pueden dise\u00f1ar de muchas maneras diferentes.<\/p>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\">Dando estilo a los links (enlaces)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Los enlaces se pueden dise\u00f1ar con cualquier propiedad CSS (por ejemplo, color, font-family, background, etc.).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Ejm<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">a {\n&nbsp;&nbsp;color: hotpink;\n}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Adem\u00e1s, los <strong>enlaces<\/strong> pueden tener un estilo diferente seg\u00fan el estado en el que se encuentren.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Los cuatro estados de enlace son:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>a:link<\/strong>: enlace normal, sin visitar<\/li>\n\n\n\n<li><strong>a:visited<\/strong>: un enlace que el usuario a visitado<\/li>\n\n\n\n<li><strong>a:hover<\/strong>: un enlace cuando el usuario tiene el rat\u00f3n sobre el mismo<\/li>\n\n\n\n<li><strong>a:active<\/strong>: un enlace en el momento de ser clicado<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Ejm<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/* unvisited link *\/\na:link {\ncolor: red;\n}\/* visited link *\/\na:visited {\ncolor: green;\n}\/* mouse over link *\/\na:hover {\ncolor: hotpink;\n}\/* selected link *\/\na:active {\ncolor: blue;\n}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Al establecer el estilo para varios estados de enlace, existen algunas reglas de orden:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>a:hover<\/strong> DEBE venir despu\u00e9s de <strong>a:link<\/strong> y <strong>a:visited<\/strong><\/li>\n\n\n\n<li><strong>a:active<\/strong> DEBE venir despu\u00e9s de <strong>a:hover<\/strong><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">text-decoration<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">La propiedad de decoraci\u00f3n de texto se usa principalmente para eliminar los subrayados de los enlaces.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Ejm<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">a:link {\n&nbsp; text-decoration: none;\n}\n\na:visited {\n&nbsp; text-decoration: none;\n}\n\na:hover {\n&nbsp;&nbsp;text-decoration: underline;\n}\n\na:active {\n&nbsp;&nbsp;text-decoration: underline;\n}<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">background-color<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">La propiedad background-color se puede usar para especificar un color de fondo para los enlaces.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Ejm<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">a:link {\n&nbsp;&nbsp;background-color: yellow;\n}\n\na:visited {\n&nbsp; background-color: cyan;\n}\n\na:hover {\n&nbsp;&nbsp;background-color: lightgreen;\n}\n\na:active {\n&nbsp;&nbsp;background-color: hotpink;\n}&nbsp;<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Botones de enlaces<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Este ejemplo muestra un ejemplo m\u00e1s avanzado en el que combinamos varias propiedades de CSS para mostrar enlaces como cuadros\/botones.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Ejm<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">a:link, a:visited {\n&nbsp;&nbsp;background-color: #f44336;\n&nbsp; color: white;\n&nbsp; padding: 14px 25px;\n&nbsp;&nbsp;text-align: center; \n&nbsp;&nbsp;text-decoration: none;\n&nbsp;&nbsp;display: inline-block;\n}\n\na:hover, a:active {\n&nbsp;&nbsp;background-color: red;\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Con CSS, los enlaces se pueden dise\u00f1ar de muchas maneras diferentes.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":563,"menu_order":26,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"class_list":["post-1272","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":"Con CSS, los enlaces se pueden dise\u00f1ar de muchas maneras diferentes.","_links":{"self":[{"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/pages\/1272","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=1272"}],"version-history":[{"count":2,"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/pages\/1272\/revisions"}],"predecessor-version":[{"id":1274,"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/pages\/1272\/revisions\/1274"}],"up":[{"embeddable":true,"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/pages\/563"}],"wp:attachment":[{"href":"https:\/\/sutilweb.eu\/index.php\/wp-json\/wp\/v2\/media?parent=1272"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}