Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>AI会社</title>
  <link rel="stylesheet" href="style.css">
</head>

<body>
  <header>
    <h1>AI会社</h1>
    <nav>
      <ul>
        <li><a href="#">ホーム</a></li>
        <li><a href="#">サービス</a></li>
        <li><a href="#">お問い合わせ</a></li>
      </ul>
    </nav>
  </header>

  <main>
    <section class="concept">
      <h2>会社コンセプト</h2>
      <p>AIについての事業を行う会社</p>
    </section>

    <section class="services">
      <h2>事業内容</h2>
      <div class="card-container">
        <div class="card">
          <h3>AIによる自動化・効率化サービスの提供</h3>
          <p>AI技術を活用して、ビジネスプロセスを自動化し、コスト削減を図るサービスを提供しています。</p>
        </div>

        <div class="card">
          <h3>AIコンサルティングサービスの提供</h3>
          <p>企画立案から運用まで、お客様のビジネス価値を最大化するAI実装を支援するサービスを提供しています。</p>
        </div>

        <div class="card">
          <h3>AIビジネスモデルの開発・提供</h3>
          <p>AI技術を活用した新たなビジネスモデルの開発・提供により、社会の発展に貢献します。</p>
        </div>
      </div>
    </section>

    <section class="contact">
  <h2>お問い合わせ</h2>
  <form>
    <label for="name">名前<span class="required">*</span>:</label>
    <input type="text" id="name" name="name" required>
    <label for="email">メールアドレス<span class="required">*</span>:</label>
    <input type="email" id="email" name="email" required>
    <label for="phone">電話番号:</label>
    <input type="tel" id="phone" name="phone">
    <label for="company">会社名:</label>
    <input type="text" id="company" name="company">
    <label for="message">メッセージ:</label>
    <textarea id="message" name="message" rows="5" required></textarea>
    <button type="submit">送信</button>
  </form>
</section>
  </main>

  <footer>
    <p>&copy; 2023 AI会社. All rights reserved.</p>
  </footer>

  <script src="script.js"></script>
</body>


              
            
!

CSS

              
                * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Helvetica Neue', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #333;
  background-color: #f9f9f9;
}

/* ヘッダー */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 30px;
  background-color: #1e2e3c;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

h1 {
  font-size: 24px;
  font-weight: 600;
  color: #fff;
}

nav ul {
  display: flex;
  list-style: none;
}

nav li {
  margin-right: 20px;
}

nav a {
  text-decoration: none;
  color: #fff;
}

nav a:hover {
  border-bottom: 2px solid #fff;
}

main {
  max-width: 960px;
  margin: 30px auto;
  padding: 0 30px;
}

.concept {
  text-align: center;
  margin-bottom: 50px;
}

.concept h2 {
  font-size: 36px;
  margin-bottom: 20px;
  color: #333;
}

.concept p {
  font-size: 18px;
  color: #666;
}

.services {
  text-align: center;
  margin-bottom: 50px;
}

.services h2 {
  font-size: 36px;
  margin-bottom: 20px;
  color: #333;
}

/* カード */
.card {
  width: 300px;
  padding: 30px;
  background-color: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.card:hover {
  transform: scale(1.05);
}

.card h3 {
  font-size: 24px;
  margin-bottom: 20px;
  color: #333;
}


.card p {
  font-size: 18px;
  color: #666;
}

.card:before {
  content: "";
  display: block;
  height: 10px;
  background-color: #000;
  margin-bottom: 20px;
}

.card-container {
  display: flex;
  justify-content: space-between;
}

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

.contact h2 {
  font-size: 36px;
  margin-bottom: 20px;
  color: #333;
}

form label {
  display: block;
  font-size: 18px;
  margin-bottom: 10px;
  color: #333;
}

form input[type="text"],
form input[type="email"],
form input[type="tel"],
form textarea {
  width: 100%;
  padding: 10px;
  margin-bottom: 20px;
  border: 2px solid #ddd;
  border-radius: 5px;
}

form textarea {
  height: 150px;
}

form button[type="submit"] {
  padding: 10px 20px;
  background-color: #333;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

form button[type="submit"]:hover {
  background-color: #666;
}

footer {
  text-align: center;
  padding: 20px;
  background-color: #333;
  color: #fff;
}

label span.required {
  color: #ff0000;
}
              
            
!

JS

              
                const form = document.querySelector('form');
const nameInput = document.querySelector('#name');
const emailInput = document.querySelector('#email');
const messageInput = document.querySelector('#message');
const errorList = document.querySelector('#errors');
const successMessage = document.querySelector('#success-message');

form.addEventListener('submit', e => {
  e.preventDefault();
  clearErrors();
  if (validateForm()) {
    const formData = new FormData(form);
    const xhr = new XMLHttpRequest();
    xhr.open('POST', 'https://example.com/api/contact');
    xhr.send(formData);
    xhr.onreadystatechange = function() {
      if (xhr.readyState === 4) {
        if (xhr.status === 200) {
          showSuccessMessage();
          clearForm();
        } else {
          showErrorMessage('An error occurred. Please try again later.');
        }
      }
    }
  }
});

function validateForm() {
  let isValid = true;
  if (nameInput.value === '') {
    showErrorMessage('Please enter your name.');
    isValid = false;
  }
  if (emailInput.value === '') {
    showErrorMessage('Please enter your email address.');
    isValid = false;
  } else if (!isValidEmail(emailInput.value)) {
    showErrorMessage('Please enter a valid email address.');
    isValid = false;
  }
  if (messageInput.value === '') {
    showErrorMessage('Please enter a message.');
    isValid = false;
  }
  return isValid;
}

function showErrorMessage(message) {
  const li = document.createElement('li');
  li.textContent = message;
  errorList.appendChild(li);
}

function clearErrors() {
  while (errorList.firstChild) {
    errorList.removeChild(errorList.firstChild);
  }
}

function showSuccessMessage() {
  successMessage.style.display = 'block';
}

function clearForm() {
  nameInput.value = '';
  emailInput.value = '';
  messageInput.value = '';
}

function isValidEmail(email) {
  return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
}
              
            
!
999px

Console