logo

Cómo agregar una línea en HTML

En HTML, podemos agregar fácilmente la línea horizontal en el documento usando las siguientes maneras diferentes:

  1. Usando la etiqueta HTML
  2. Usando el CSS interno

Usando HTML

Si queremos agregar la línea Horizontal en el documento HTML usando etiqueta HTML , entonces tenemos que seguir los pasos que se detallan a continuación. Siguiendo estos pasos, podemos agregar fácilmente la línea:

Paso 1: En primer lugar, tenemos que escribir el código HTML en cualquier editor de texto o abrir el archivo HTML existente en el editor de texto en el que queremos agregar la línea horizontal.

 Add the Line using Html tags This page helps you to understand how to add the line in Html document. And, this section helps you to understand how to add the line using the Html tags. 

Paso 2: Ahora, colocamos el cursor en el punto donde queremos agregar la línea en el documento HTML. Y luego tenemos que usar el


etiqueta de HTML en ese punto.

 <hr> 

Paso 3: Ahora tenemos que sumar los atributos de


etiqueta, que define el tamaño, color y ancho de una línea. Entonces, tenemos que escribir el atributo de tamaño, ancho y color dentro del
etiqueta.

 <hr> 

Etapa 4: Y luego tenemos que especificar los valores de estos atributos.

 <hr> 

Paso 5: Y, por último, tenemos que guardar el código HTML y luego ejecutar el archivo en el navegador.

 Add the Line using Html tags This page helps you to understand how to add the line in Html document. <hr> And, this section helps you to understand how to add the line using the Html tag. 
Pruébalo ahora

El resultado del código HTML anterior se muestra en la siguiente captura de pantalla:

Cómo agregar una línea en HTML

Usando el CSS interno

Si queremos agregar la línea horizontal en el documento HTML usando la hoja de estilo interna, debemos seguir los pasos que se detallan a continuación. Siguiendo estos pasos, podemos agregar fácilmente la línea:

Paso 1: En primer lugar, tenemos que escribir el código HTML en cualquier editor de texto o abrir el archivo HTML existente en el editor de texto en el que queremos agregar la línea horizontal.

 Add the Line using Internal CSS. This page helps you to understand how to add the line in Html document. And, this section helps you to understand how to add the line using the Internal Cascading Style Sheet. 

Paso 2: Ahora, tenemos que colocar el cursor justo después del cierre de la etiqueta del título en el etiqueta de cabeza del documento HTML y luego definir los estilos dentro del etiqueta como se muestra en el siguiente bloque. Y luego tenemos que escribir la etiqueta hr CSS para diseñar la línea horizontal.

 Add the Line using Internal CSS. hr { } 

Paso 3: Ahora tenemos que definir los atributos de la etiqueta hr CSS. Entonces, definiremos los diferentes atributos en el siguiente bloque:

 Add the Line using Internal CSS. hr { width: 80%; height: 2px; background-color: pink; margin-bottom: 7px; margin-right: auto; margin-left: auto; margin-top: 9px; border-width: 4px; border-color: blue; } 

Etapa 4: Ahora tenemos que escribir el


etiqueta en el cuerpo del documento HTML para mostrar la línea horizontal en la página web. Y, por último, tenemos que guardar el archivo HTML y luego ejecutarlo en el navegador de Internet.

 Add the Line using Internal CSS. hr { width: 80%; height: 2px; background-color: pink; margin-bottom: 7px; margin-right: auto; margin-left: auto; margin-top: 9px; border-width: 4px; border-color: blue; } This page helps you to understand how to add the line in Html document. <hr> And, this section helps you to understand how to add the line using the Internal Cascading Style Sheet. 
Pruébalo ahora

El resultado del código HTML anterior se muestra en la siguiente captura de pantalla:

Cómo agregar una línea en HTML