Skip to content
TheChatArchiveThe Chat Archive
gpt-4-0314· openaiHugging Face Suzhen/CodeChat

ejemplos de codigo de html

  1. User

    ejemplos de codigo de html

  2. Assistant

    Aquí tienes varios ejemplos de código HTML, desde lo más básico a estructuras más complejas.

    1. Estructura básica de un documento HTML:
    <!DOCTYPE html>
    <html lang="es">
    <head>
      <meta charset="UTF-8">
      <title>Titulo de la página</title>
    </head>
    <body>
    
      <h1>¡Hola, mundo!</h1>
    
    </body>
    </html>
    
    1. Creación de una lista desordenada y lista ordenada:
    <!DOCTYPE html>
    <html lang="es">
    <head>
      <meta charset="UTF-8">
      <title>Listas en HTML</title>
    </head>
    <body>
    
      <h2>Lista desordenada</h2>
      <ul>
        <li>Elemento 1</li>
        <li>Elemento 2</li>
        <li>Elemento 3</li>
      </ul>
    
      <h2>Lista ordenada</h2>
      <ol>
        <li>Primer elemento</li>
        <li>Segundo elemento</li>
        <li>Tercer elemento</li>
      </ol>
    
    </body>
    </html>
    
    1. Estructura de una tabla:
    <!DOCTYPE html>
    <html lang="es">
    <head>
      <meta charset="UTF-8">
      <title>Tabla en HTML</title>
    </head>
    <body>
    
      <table border="1">
        <caption>Tabla de ejemplo</caption>
        <thead>
          <tr>
            <th>Encabezado 1</th>
            <th>Encabezado 2</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>Celda 1,1</td>
            <td>Celda 1,2</td>
          </tr>
          <tr>
            <td>Celda 2,1</td>
            <td>Celda 2,2</td>
          </tr>
        </tbody>
      </table>
    
    </body>
    </html>
    
    1. Enlaces y manejo de imágenes:
    <!DOCTYPE html>
    <html lang="es">
    <head>
      <meta charset="UTF-8">
      <title>Enlaces e imágenes en HTML</title>
    </head>
    <body>
    
      <h2>Enlaces</h2>
      <p><a href="https://www.ejemplo.com">Visitar sitio Ejemplo</a></p>
      
      <h2>Imágenes</h2>
      <img src="ruta-de-la-imagen.jpg" alt="Descripción de la imagen" width="300">
    
    </body>
    </html>
    
    1. Formulario básico:
    <!DOCTYPE html>
    <html lang="es">
    <head>
      <meta charset="UTF-8">
      <title>Formulario en HTML</title>
    </head>
    <body>
    
      <form action="procesar.php" method="post">
        <label for="nombre">Nombre:</label>
        <input type="text" id="nombre" name="nombre">
        <br>
        
        <label for="correo">Correo electrónico:</label>
        <input type="email" id="correo" name="correo">
        <br>
        
        <input type="submit" value="Enviar">
      </form>
    
    </body>
    </html>
    

    Estos ejemplos son una muestra básica de lo que se puede lograr con HTML. Existen muchos otros elementos y atributos que puedes explorar para crear sitios web más elaborados y funcionales.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.