Menu
×
   ❮   
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

ChatGPT-4 代码网站


使用 ChatGPT-4 创建网站

使用 ChatGPT-4 创建网站就像有一个网页开发者在你身边帮助你一样。

ChatGPT 可以帮助你入门!


写下你的想法

在使用生成式人工智能来帮助你之前,你必须弄清楚你想要网站包含什么。

一些需要考虑的步骤

  • 网站是关于什么的?
  • 你需要图片吗?
  • 你需要联系信息吗?

你提供的信息越详细,ChatGPT 的表现就越好。


生成网站代码

以我们的例子为例,我们将要求 ChatGPT 创建一个简单的网页。

示例

使用以下提示

创建一个简单的网页,包含我的蛋糕店名称“Magically Delicious”,简短的描述,几张图片以及我的联系方式(Genevieve Lavorre,邮箱:[email protected]

ChatGPT-4 的响应可能是

让我们测试一下代码:(我们使用 Midjourney 生成了 3 张图片)

示例

<!DOCTYPE html>
<html>
<head>
  <title>Magically Delicious Cupcakes</title>
  <style>
    body {
      background-color: #f8f1f1;
      font-family: Arial, sans-serif;
    }

    h1, h2 {
      color: #ff85a2;
    }

    .container {
      width: 80%;
      margin: auto;
    }

    .images {
      display: flex;
      justify-content: space-between;
      margin-top: 20px;
    }

    .images img {
      width: 30%;
      border-radius: 10px;
    }
  </style>
</head>
<body>
  <div class="container">
    <h1>Welcome to Magically Delicious Cupcakes!</h1>

    <p>We provide a variety of gourmet cupcakes with magical flavors that take you to a world of deliciousness. We believe in quality, taste, and a sprinkle of magic in every cupcake!</p>

    <h2>Our Delicious Creations</h2>

    <div class="images">
      <img src="img_cupcake1.png" alt="Cupcake 1">
      <img src="img_cupcake2.png" alt="Cupcake 2">
      <img src="img_cupcake3.png" alt="Cupcake 3">
    </div>

    <h2>Contact Us</h2>
    
    <p>For orders and inquiries:</p>
    
    <p>Name: Genevieve Lavorre</p>
    <p>Email: <a href="mailto:[email protected]">[email protected]</a></p>
  </div>
</body>
</html>
自己尝试一下 »

看起来不错!


审阅代码并进行迭代

浏览 ChatGPT 的响应,这是一个很好的起点。

让我们再寻求一些帮助

示例

使用以下提示

让页面看起来更好

ChatGPT-4 的响应可能是

让我们测试一下代码

示例

<!DOCTYPE html>
<html>
<head>
  <title>Magically Delicious Cupcakes</title>
  <style>
    body {
      background-color: #ffe0e9;
      font-family: 'Arial', sans-serif;
      color: #4d194d;
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    .container {
      width: 90%;
      margin: auto;
      max-width: 1200px;
    }

    h1, h2 {
      color: #ff85a2;
      text-align: center;
    }

    h1 {
      margin-top: 20px;
      font-size: 2.5em;
    }

    h2 {
      font-size: 2em;
      margin-top: 40px;
    }

    p {
      font-size: 1.2em;
      line-height: 1.6;
      text-align: justify;
    }

    .images {
      display: flex;
      justify-content: space-between;
      margin-top: 20px;
      flex-wrap: wrap;
    }

    .images img {
      width: 30%;
      border-radius: 10px;
      margin: 1%;
      box-shadow: 5px 5px 20px rgba(0, 0, 0, 0.1);
    }

    .contact {
      text-align: center;
      margin-top: 50px;
      margin-bottom: 20px;
    }

    a {
      color: #4d194d;
      text-decoration: none;
    }

    a:hover {
      color: #ff85a2;
    }
  </style>
</head>
<body>
  <div class="container">
    <h1>Welcome to Magically Delicious Cupcakes!</h1>

    <p>We provide a variety of gourmet cupcakes with magical flavors that take you to a world of deliciousness. We believe in quality, taste, and a sprinkle of magic in every cupcake!</p>

    <h2>Our Delicious Creations</h2>

    <div class="images">
      <img src="img_cupcake1.png" alt="Cupcake 1">
      <img src="img_cupcake2.png" alt="Cupcake 2">
      <img src="img_cupcake3.png" alt="Cupcake 3">
    </div>

    <div class="contact">
      <h2>Contact Us</h2>
      <p>For orders and inquiries:</p>
      <p>Name: Genevieve Lavorre</p>
      <p>Email: <a href="mailto:[email protected]">[email protected]</a></p>
    </div>
  </div>
</body>
</html>
自己尝试一下 »

这是一个非常简单的页面,但像这样快速入门可以节省大量时间。


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.