メインコンテンツへスキップ
見出し画像

英語サイト制作のためのテキスト処理とフォント設定:シーン別実装ガイド①


    はじめに

    日本語サイトを英語化する際には、単なる翻訳だけでなく、テキスト特性の違いに合わせたHTML/CSS実装が必要になります。本記事では、実際のウェブサイト制作シーンごとに、段階的な実装方法をシェアします。新人エンジニアの方でも理解しやすいよう、用語解説も含めました。

    用語解説

    まず、英語サイト制作で重要な用語を理解しましょう。

    用語 解説
    コンテナ コンテンツを包む要素。幅や余白などを制御する「箱」のような役割を持ちます。
    ハイフネーション 長い英単語が行末に来たときに、ハイフン(-)で分割する機能。CSS hyphens プロパティで制御します。
    ワードラップ 長い英単語を強制的に折り返す機能。CSS word-wrap/overflow-wrap プロパティを使用します。
    行長 1行あたりのテキスト長。英語では約70文字(70ch)が最適とされています。
    システムフォントスタック 各OSやデバイスのネイティブフォントを順に指定する方法。パフォーマンスと見た目のバランスに優れています。
    ch単位 CSS単位の一つで、フォントの「0」の幅を基準とします。英文の行長指定に適しています。
    行間(line-height) テキスト行間のスペース。
    英語では1.5〜1.6倍が読みやすいとされています。
    レスポンシブデザイン 様々な画面サイズに対応するデザイン手法。メディアクエリを使用して実装します。

    シーン1:ブログ記事ページの実装

    ブログ記事では、長い英文の可読性が最も重要です。段階的に実装していきましょう。

    ステップ1: 基本HTMLの作成

    <!DOCTYPE html>
    <!-- HTML5の宣言 -->
    <html lang="en">
    <!-- 言語を英語に指定。スクリーンリーダーや検索エンジンに言語情報を伝える -->
    <head>
        <meta charset="UTF-8">
        <!-- 文字エンコーディングをUTF-8に指定。多言語対応に必須 -->
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <!-- ビューポート設定。レスポンシブデザインの基本 -->
        <title>Blog Article Title</title>
        <!-- ページタイトル。検索結果に表示される重要要素 -->
        <link rel="stylesheet" href="styles.css">
        <!-- 外部CSSの読み込み -->
    </head>
    <body>
        <div class="container">
            <!-- コンテナ要素。コンテンツの幅と配置を制御 -->
            <article class="blog-post">
                <!-- 記事のメインコンテンツを包む要素 -->
                <header class="post-header">
                    <!-- 記事のヘッダー部分 -->
                    <h1 class="post-title">The Future of Sustainable Technology</h1>
                    <!-- 記事タイトル。ページの主要見出し -->
                    <div class="post-meta">
                        <!-- 投稿メタデータ(日付、著者など) -->
                        <time datetime="2025-04-24">April 24, 2025</time>
                        <!-- 日付情報。datetime属性でコンピュータ可読形式も提供 -->
                        <span class="author">By John Smith</span>
                        <!-- 著者情報 -->
                    </div>
                </header>
                
                <div class="post-content">
                    <!-- 記事本文を包む要素 -->
                    <p class="lead-paragraph">
                        <!-- リード文(導入段落)。記事の要約や導入部分 -->
                        This article explores how sustainable technology is reshaping our future and creating new opportunities for environmental conservation.
                    </p>
                    
                    <h2>Introduction to Sustainable Technology</h2>
                    <!-- セクション見出し -->
                    <p>
                        Sustainable technology refers to technology that considers long-term environmental impacts while meeting present needs. As global challenges like climate change intensify, these innovations become increasingly critical.
                    </p>
                    
                    <p>
                        Environmentalconsciousnesstransformation is a term that describes the fundamental shift in how we approach technology development with sustainability at its core.
                    </p>
                    <!-- 意図的に長い単語を含めた段落。ワードラップとハイフネーションの効果を確認するため -->
                    
                    <blockquote>
                        <!-- 引用ブロック -->
                        <p>"The greatest threat to our planet is the belief that someone else will save it." - Robert Swan</p>
                        <!-- 引用文 -->
                    </blockquote>
                </div>
            </article>
        </div>
    </body>
    </html>
    

    ステップ2: 基本CSSの作成

    /* 基本リセットとボックスモデル設定 */
    * {
        /* 全要素に適用 */
        box-sizing: border-box;
        /* paddingとborderを幅と高さに含める。レイアウト計算が容易になる */
        margin: 0;
        /* 全要素のマージンをリセット */
        padding: 0;
        /* 全要素のパディングをリセット */
    }
    
    /* 基本フォント設定 */
    body {
        /* システムフォントスタック - 各OSで最適なフォントを自動選択 */
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
                     Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
        /* 上記はApple、Windows、Android、Linuxなど各環境の標準フォントを順に指定 */
        
        font-size: 16px;
        /* 基本フォントサイズ。一般的に16pxが読みやすいとされる */
        
        line-height: 1.6;
        /* 英語テキストに適した行間。1.5〜1.6が読みやすい */
        
        color: #333 ;
        /* テキスト色。純黒(#000)より暗めのグレーの方が目に優しい */
        
        background-color: #fff ;
        /* 背景色 */
    }
    
    /* コンテナ設定 */
    .container {
        max-width: 800px;
        /* コンテナの最大幅を制限。大画面での読みやすさを確保 */
        
        margin: 0 auto;
        /* 上下マージンは0、左右は自動で中央揃え */
        
        padding: 20px;
        /* コンテナ内部の余白 */
    }
    
    /* ブログ記事全体 */
    .blog-post {
        margin-bottom: 40px;
        /* 記事下部のマージン */
    }
    
    /* 記事タイトル */
    .post-title {
        font-size: 2.5rem;
        /* タイトルのフォントサイズ。remは基本フォントサイズの倍数 */
        
        line-height: 1.2;
        /* 見出しの行間は本文より狭めに設定 */
        
        margin-bottom: 0.5em;
        /* 下部マージン。emは要素自体のフォントサイズを基準とした単位 */
        
        font-weight: 700;
        /* フォントの太さ。700は太字(bold)を意味する */
        
        /* 長い単語の折り返し処理 */
        word-wrap: break-word;
        /* 単語内での折り返しを許可 */
        
        overflow-wrap: break-word;
        /* 新しい仕様名。長い単語を折り返す */
        
        hyphens: none;
        /* 見出しではハイフネーションを無効化。読みやすさを優先 */
    }
    
    /* メタデータ(日付、著者など) */
    .post-meta {
        font-size: 0.9rem;
        /* やや小さめのフォントサイズ */
        
        color: #666 ;
        /* 薄めの色で主コンテンツと区別 */
        
        margin-bottom: 2rem;
        /* 下部マージン */
    }
    
    /* リード段落(導入部) */
    .lead-paragraph {
        font-size: 1.2rem;
        /* やや大きめのフォントサイズ */
        
        line-height: 1.5;
        /* 行間設定 */
        
        margin-bottom: 1.5rem;
        /* 下部マージン */
        
        font-weight: 500;
        /* やや太めの文字 */
    }
    
    /* 通常段落 */
    .post-content p {
        margin-bottom: 1.5rem;
        /* 段落間のマージン */
        
        max-width: 70ch;
        /* 最大幅を約70文字分に制限。英文の適切な行長 */
        
        /* 英文処理のための設定 */
        word-wrap: break-word;
        /* 長い単語の折り返し */
        
        hyphens: auto;
        /* 自動ハイフネーションを有効化 */
        
        -webkit-hyphens: auto;
        /* Safari用のプレフィックス */
        
        -moz-hyphens: auto;
        /* Firefox用のプレフィックス */
    }
    
    /* セクション見出し */
    h2 {
        font-size: 1.8rem;
        /* フォントサイズ */
        
        line-height: 1.3;
        /* 行間 */
        
        margin-top: 2rem;
        /* 上部マージン */
        
        margin-bottom: 1rem;
        /* 下部マージン */
    }
    
    /* 引用ブロック */
    blockquote {
        font-style: italic;
        /* イタリック体(斜体) */
        
        border-left: 4px solid #ddd ;
        /* 左側に枠線を追加 */
        
        padding-left: 1rem;
        /* 左側の内部余白 */
        
        margin: 2rem 0;
        /* 上下のマージン */
        
        color: #555 ;
        /* テキスト色 */
    }
    

    ステップ3: レスポンシブ対応を追加

    /* レスポンシブ対応 - タブレット向け */
    @media (max-width: 768px) {
        /* 画面幅が768px以下の場合に適用されるスタイル */
        
        .post-title {
            font-size: 2rem;
            /* 画面サイズに合わせてタイトルサイズを縮小 */
        }
        
        .lead-paragraph {
            font-size: 1.1rem;
            /* リード文のサイズも調整 */
        }
    }
    
    /* レスポンシブ対応 - スマートフォン向け */
    @media (max-width: 480px) {
        /* 画面幅が480px以下の場合に適用されるスタイル */
        
        body {
            font-size: 15px;
            /* 基本フォントサイズを少し小さく */
        }
        
        .container {
            padding: 15px;
            /* 余白を少し狭く */
        }
        
        .post-title {
            font-size: 1.6rem;
            /* タイトルをさらに小さく */
        }
        
        .post-content p {
            /* 小画面での段落設定 */
            min-width: auto;
            /* 最小幅の制限を解除 */
            
            line-height: 1.5;
            /* 行間を少し縮める */
        }
    }
    

    シーン2: 企業サイトの製品紹介ページ

    製品紹介では、視覚的な魅力と情報の明確さが重要です。

    ステップ1: 基本HTMLの作成

    <!DOCTYPE html>
    <!-- HTML5の宣言 -->
    <html lang="en">
    <!-- 言語を英語に指定 -->
    <head>
        <meta charset="UTF-8">
        <!-- 文字エンコーディング設定 -->
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <!-- ビューポート設定 -->
        <title>Product Name - Company Name</title>
        <!-- 製品名と会社名を含めたタイトル。SEO対策として重要 -->
        <link rel="stylesheet" href="product-styles.css">
        <!-- 外部CSSの読み込み -->
    </head>
    <body>
        <div class="product-container">
            <!-- 製品ページのコンテナ -->
            <header class="product-header">
                <!-- 製品ヘッダー部分 -->
                <h1 class="product-name">EcoTech Pro X7000</h1>
                <!-- 製品名。特に長い製品名の場合は折り返し処理が重要 -->
                <p class="product-tagline">Revolutionizing sustainability with next-generation technology</p>
                <!-- 製品キャッチフレーズ -->
            </header>
            
            <div class="product-showcase">
                <!-- 製品紹介メインエリア -->
                <div class="product-image">
                    <!-- 製品画像エリア -->
                    <img src="product-image.jpg" alt="EcoTech Pro X7000 device" width="500" height="300">
                    <!-- 製品画像。alt属性で画像の説明を提供。widthとheightで表示サイズを指定 -->
                </div>
                
                <div class="product-info">
                    <!-- 製品情報エリア -->
                    <div class="product-description">
                        <!-- 製品説明文 -->
                        <h2>About This Product</h2>
                        <!-- セクション見出し -->
                        <p>
                            The EcoTech Pro X7000 is our flagship sustainability solution, designed to reduce environmental impact while maximizing efficiency in industrial settings.
                        </p>
                        <p>
                            With revolutionary ElectroEnvironmentalOptimizationTechnology, our product delivers unparalleled performance in energy conservation and waste reduction.
                        </p>
                        <!-- 意図的に長い単語を含めた文章 -->
                    </div>
                    
                    <div class="product-features">
                        <!-- 製品特徴リスト -->
                        <h2>Key Features</h2>
                        <!-- セクション見出し -->
                        <ul>
                            <!-- 順序なしリスト -->
                            <li>99.7% energy efficiency rating</li>
                            <!-- リスト項目 -->
                            <li>Carbon-neutral manufacturing process</li>
                            <li>Smart adaptation to environmental conditions</li>
                            <li>Comprehensive recycling program</li>
                        </ul>
                    </div>
                    
                    <div class="product-cta">
                        <!-- Call To Action(行動喚起)エリア -->
                        <a href="contact.html" class="cta-button">Request Information</a>
                        <!-- CTA ボタン -->
                    </div>
                </div>
            </div>
        </div>
    </body>
    </html>
    

    ステップ2: 製品紹介ページのCSS作成

    /* 基本リセットとボックスモデル設定 */
    * {
        box-sizing: border-box;
        /* パディングとボーダーを幅と高さに含める */
        margin: 0;
        padding: 0;
    }
    
    /* 基本フォント設定 */
    body {
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
                     Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
        /* システムフォントスタック */
        
        font-size: 16px;
        line-height: 1.6;
        color: #333 ;
        background-color: #f8f8f8 ;
        /* 明るめの背景色で清潔感を演出 */
    }
    
    /* 製品ページコンテナ */
    .product-container {
        max-width: 1200px;
        /* 製品ページは通常記事より広めのコンテナを使用 */
        
        margin: 0 auto;
        padding: 40px 20px;
        /* 余白を広めに取る */
    }
    
    /* 製品ヘッダー */
    .product-header {
        text-align: center;
        /* ヘッダーは中央揃え */
        
        margin-bottom: 40px;
        /* 下部マージン */
    }
    
    /* 製品名 */
    .product-name {
        font-size: 3rem;
        /* 大きめのフォントサイズで目立たせる */
        
        line-height: 1.2;
        font-weight: 700;
        color: #222 ;
        /* やや濃い色 */
        
        margin-bottom: 0.5rem;
        /* 下部マージン */
        
        /* 長い製品名の処理 */
        word-wrap: break-word;
        overflow-wrap: break-word;
        
        /* 製品名はハイフネーションしない */
        hyphens: none;
    }
    
    /* 製品キャッチフレーズ */
    .product-tagline {
        font-size: 1.4rem;
        /* やや大きめのフォントサイズ */
        
        line-height: 1.4;
        font-weight: 300;
        /* 細めのフォントウェイト */
        
        color: #555 ;
        /* 薄めの色 */
        
        max-width: 70ch;
        /* 適切な行長 */
        
        margin: 0 auto;
        /* 中央揃え */
    }
    
    /* 製品紹介エリア */
    .product-showcase {
        display: flex;
        /* フレックスボックスレイアウト - 横並び表示を実現 */
        
        flex-wrap: wrap;
        /* 画面幅が狭い場合は折り返し */
        
        gap: 40px;
        /* アイテム間のスペース */
        
        align-items: flex-start;
        /* アイテムを上端揃え */
    }
    
    /* 製品画像エリア */
    .product-image {
        flex: 1;
        /* 伸縮可能なフレックスアイテム */
        
        min-width: 300px;
        /* 最小幅を保証 */
    }
    
    .product-image img {
        max-width: 100%;
        /* 画像がコンテナからはみ出さないように */
        
        height: auto;
        /* 縦横比を維持 */
        
        display: block;
        /* インライン要素特有の余白を削除 */
        
        border-radius: 8px;
        /* 角を丸く */
        
        box-shadow: 0 4px 20px rgba(0,0,0,0.1);
        /* 微妙な影をつける */
    }
    
    /* 製品情報エリア */
    .product-info {
        flex: 1;
        /* 伸縮可能なフレックスアイテム */
        
        min-width: 300px;
        /* 最小幅を保証 */
    }
    
    /* 製品説明文 */
    .product-description {
        margin-bottom: 30px;
        /* 下部マージン */
    }
    
    /* 製品説明文の段落 */
    .product-description p {
        margin-bottom: 1rem;
        /* 段落間の間隔 */
        
        /* 英語テキスト処理 */
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        -webkit-hyphens: auto;
        -moz-hyphens: auto;
    }
    
    /* セクション見出し */
    .product-info h2 {
        font-size: 1.6rem;
        line-height: 1.3;
        margin-bottom: 1rem;
        color: #222 ;
    }
    
    /* 製品特徴リスト */
    .product-features ul {
        list-style-position: inside;
        /* リストマーカーを内側に配置 */
        
        margin-bottom: 30px;
        /* 下部マージン */
    }
    
    .product-features li {
        margin-bottom: 0.5rem;
        /* リスト項目間の間隔 */
        
        padding-left: 1.5rem;
        /* 左側の余白 */
        
        position: relative;
        /* 相対位置指定。カスタムマーカーのための基準点 */
    }
    
    .product-features li::before {
        content: "✓";
        /* チェックマークをリストマーカーとして使用 */
        
        position: absolute;
        /* 絶対位置指定 */
        
        left: 0;
        /* 左端に配置 */
        
        color: #2ecc71 ;
        /* マーカーの色(緑) */
    }
    
    /* CTA(行動喚起)ボタン */
    .cta-button {
        display: inline-block;
        /* インラインブロック要素として表示 */
        
        padding: 12px 24px;
        /* 内部余白 */
        
        background-color: #2ecc71 ;
        /* 背景色(緑) */
        
        color: white;
        /* テキスト色 */
        
        text-decoration: none;
        /* 下線を削除 */
        
        font-weight: 600;
        /* やや太めのフォント */
        
        border-radius: 4px;
        /* 角を丸く */
        
        transition: background-color 0.3s;
        /* 背景色の変化をアニメーション化 */
    }
    
    .cta-button:hover {
        background-color: #27ae60 ;
        /* ホバー時の背景色(暗めの緑) */
    }
    

    ステップ3: レスポンシブ対応を追加

    /* レスポンシブ対応 - タブレット向け */
    @media (max-width: 900px) {
        .product-name {
            font-size: 2.5rem;
            /* タイトルサイズ調整 */
        }
        
        .product-tagline {
            font-size: 1.2rem;
            /* キャッチフレーズサイズ調整 */
        }
        
        .product-showcase {
            gap: 30px;
            /* アイテム間隔を少し狭く */
        }
    }
    
    /* レスポンシブ対応 - スマートフォン向け */
    @media (max-width: 600px) {
        .product-container {
            padding: 20px 15px;
            /* 余白を狭く */
        }
        
        .product-name {
            font-size: 2rem;
            /* さらにタイトルサイズを小さく */
        }
        
        .product-tagline {
            font-size: 1.1rem;
            /* キャッチフレーズもさらに小さく */
        }
        
        .product-info {
            order: 1;
            /* モバイルでは情報を先に表示 */
        }
        
        .product-image {
            order: 2;
            /* モバイルでは画像を後に表示 */
        }
        
        .cta-button {
            display: block;
            /* ボタンをブロック要素に変更して幅いっぱいに */
            
            text-align: center;
            /* テキストを中央揃え */
        }
    }
    

    シーン3: 多言語対応ドキュメントページ

    技術文書やヘルプページなど、情報の構造化と可読性が最も重要なケースです。

    ステップ1: 基本HTMLの作成

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>API Documentation - Developer Guide</title>
        <link rel="stylesheet" href="docs-styles.css">
    </head>
    <body>
        <div class="docs-container">
            <!-- ドキュメント全体のコンテナ -->
            
            <aside class="docs-sidebar">
                <!-- サイドバー(目次) -->
                <div class="docs-logo">
                    <img src="logo.svg" alt="API Documentation Logo" width="150" height="40">
                </div>
                
                <nav class="docs-nav">
                    <!-- ナビゲーションメニュー -->
                    <h2>Contents</h2>
                    <ul>
                        <li><a href="#introduction" class="active">Introduction</a></li>
                        <li><a href="#getting-started">Getting Started</a></li>
                        <li><a href="#authentication">Authentication</a></li>
                        <li><a href="#endpoints">API Endpoints</a></li>
                        <li><a href="#error-handling">Error Handling</a></li>
                    </ul>
                </nav>
                
                <div class="language-switcher">
                    <!-- 言語切り替え -->
                    <h2>Language</h2>
                    <ul>
                        <li><a href="#" class="active">English</a></li>
                        <li><a href="#">日本語</a></li>
                        <li><a href="#">Español</a></li>
                        <li><a href="#">Français</a></li>
                    </ul>
                </div>
            </aside>
            
            <main class="docs-content">
                <!-- ドキュメント本文 -->
                <section id="introduction" class="docs-section">
                    <!-- 導入セクション -->
                    <h1>API Documentation</h1>
                    <p class="docs-lead">
                        Welcome to our API documentation. This guide will help you integrate our services into your applications.
                    </p>
                    
                    <p>
                        Our RESTful API provides programmatic access to our platform's functionality, allowing developers to build innovative applications that leverage our infrastructure.
                    </p>
                    
                    <div class="info-box">
                        <!-- 情報ボックス -->
                        <h3>Note</h3>
                        <p>
                            This documentation assumes you have basic knowledge of RESTful APIs and HTTP request methods. If you're new to APIs, we recommend reviewing our <a href="#">Beginner's Guide</a> first.
                        </p>
                    </div>
                </section>
                
                <section id="getting-started" class="docs-section">
                    <!-- 使い方セクション -->
                    <h2>Getting Started</h2>
                    <p>
                        To begin using our API, you'll need to create a developer account and obtain your API keys. Follow these steps to get started:
                    </p>
                    
                    <ol>
                        <!-- 順序付きリスト -->
                        <li>Register for a developer account at <a href="#">developer.example.com</a></li>
                        <li>Navigate to the API Keys section in your dashboard</li>
                        <li>Generate a new API key</li>
                        <li>Store your API key securely - it will only be shown once</li>
                    </ol>
                    
                    <h3>Example Request</h3>
                    <pre><code>curl -X GET "https://api.example.com/v1/users" \
        -H "Authorization: Bearer YOUR_API_KEY" \
        -H "Content-Type: application/json"</code></pre>
                    <!-- コードブロック。APIリクエスト例 -->
                </section>
                
                <!-- 以下、他のセクションが続く... -->
            </main>
        </div>
    </body>
    </html>
    

    ステップ2: ドキュメントページのCSSを作成

    /* 基本リセットとボックスモデル設定 */
    * {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }
    
    /* 基本フォント設定 */
    body {
        /* モノスペースフォントも含むシステムフォントスタック */
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
                     Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
        font-size: 16px;
        line-height: 1.6;
        color: #333 ;
        background-color: #fff ;
    }
    
    /* ドキュメントコンテナ */
    .docs-container {
        display: flex;
        /* サイドバーとメインコンテンツの横並び */
        
        max-width: 1400px;
        /* コンテナの最大幅 */
        
        margin: 0 auto;
        /* 中央揃え */
        
        min-height: 100vh;
        /* 最低でも画面の高さいっぱいに */
    }
    
    /* サイドバー */
    .docs-sidebar {
        width: 280px;
        /* サイドバーの固定幅 */
        
        padding: 30px 20px;
        /* 内部余白 */
        
        background-color: #f8f9fa ;
        /* 薄いグレーの背景色 */
        
        border-right: 1px solid #e9ecef ;
        /* 右側に境界線 */
        
        position: sticky;
        /* スクロールしても位置固定 */
        
        top: 0;
        /* 画面上部に固定 */
        
        height: 100vh;
        /* 画面の高さいっぱい */
        
        overflow-y: auto;
        /* 内容が多い場合は縦スクロール可能に */
    }
    
    /* ロゴエリア */
    .docs-logo {
        margin-bottom: 30px;
        /* 下部マージン */
    }
    
    .docs-logo img {
        display: block;
        /* ブロック要素として表示 */
        
        max-width: 100%;
        /* コンテナからはみ出さないように */
    }
    
    /* ナビゲーションとサイドバー見出し */
    .docs-sidebar h2 {
        font-size: 1.1rem;
        /* 小さめのフォントサイズ */
        
        text-transform: uppercase;
        /* 大文字表示 */
        
        letter-spacing: 1px;
        /* 文字間隔を広く */
        
        color: #6c757d ;
        /* グレーの文字色 */
        
        margin: 20px 0 10px;
        /* マージン設定 */
    }
    
    /* サイドバーナビゲーション */
    .docs-nav ul, .language-switcher ul {
        list-style: none;
        /* リストマーカーを非表示 */
    }
    
    .docs-nav li, .language-switcher li {
        margin-bottom: 5px;
        /* リスト項目間の間隔 */
    }
    
    .docs-nav a, .language-switcher a {
        display: block;
        /* ブロック要素として表示でクリック領域を広く */
        
        padding: 8px 10px;
        /* 内部余白 */
        
        text-decoration: none;
        /* 下線を削除 */
        
        color: #495057 ;
        /* テキスト色 */
        
        border-radius: 4px;
        /* 角を丸く */
        
        transition: background-color 0.2s;
        /* 背景色の変化をアニメーション化 */
    }
    
    .docs-nav a:hover, .language-switcher a:hover {
        background-color: #e9ecef ;
        /* ホバー時の背景色 */
    }
    
    .docs-nav a.active, .language-switcher a.active {
        background-color: #007bff ;
        /* アクティブなリンクの背景色(青) */
        
        color: white;
        /* アクティブなリンクのテキスト色 */
    }
    
    /* メインコンテンツエリア */
    .docs-content {
        flex: 1;
        /* 残りのスペースを全て使用 */
        
        padding: 40px;
        /* 内部余白 */
        
        max-width: 900px;
        /* コンテンツの最大幅 */
    }
    
    /* ドキュメントセクション */
    .docs-section {
        margin-bottom: 60px;
        /* セクション間のマージン */
    }
    
    /* 見出し */
    .docs-content h1 {
        font-size: 2.5rem;
        line-height: 1.2;
        margin-bottom: 1rem;
        /* 下部マージン */
        
        color: #212529 ;
        /* 見出しの色 */
        
        font-weight: 700;
        /* 太字 */
    }
    
    .docs-content h2 {
        font-size: 1.8rem;
        line-height: 1.3;
        margin-top: 2rem;
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid #dee2e6 ;
        /* 下部に境界線を追加 */
    }
    
    .docs-content h3 {
        font-size: 1.4rem;
        line-height: 1.4;
        margin-top: 1.5rem;
        margin-bottom: 1rem;
    }
    
    /* リード文 */
    .docs-lead {
        font-size: 1.2rem;
        /* 大きめのフォントサイズ */
        
        line-height: 1.5;
        /* 行間 */
        
        margin-bottom: 1.5rem;
        /* 下部マージン */
    }
    
    /* 通常の段落 */
    .docs-content p {
        margin-bottom: 1rem;
        /* 段落間のマージン */
        
        max-width: 70ch;
        /* 英文の適切な行長 */
        
        /* 英語テキスト処理 */
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        -webkit-hyphens: auto;
        -moz-hyphens: auto;
    }
    
    /* リストスタイル */
    .docs-content ol, .docs-content ul {
        margin-bottom: 1rem;
        /* リスト全体の下部マージン */
        
        padding-left: 2rem;
        /* リスト全体の左パディング */
    }
    
    .docs-content li {
        margin-bottom: 0.5rem;
        /* リスト項目間のマージン */
    }
    
    /* 情報ボックス */
    .info-box {
        background-color: #e9f5fe ;
        /* 薄い青の背景色 */
        
        border-left: 4px solid #007bff ;
        /* 左側に青い枠線 */
        
        padding: 15px 20px;
        /* 内部余白 */
        
        margin: 20px 0;
        /* 上下のマージン */
        
        border-radius: 4px;
        /* 角を丸く */
    }
    
    .info-box h3 {
        margin-top: 0;
        /* 上部マージンをリセット */
        
        color: #007bff ;
        /* 見出し色を青に */
    }
    
    /* コードブロック */
    pre {
        background-color: #f8f9fa ;
        /* 背景色 */
        
        border: 1px solid #e9ecef ;
        /* 枠線 */
        
        border-radius: 4px;
        /* 角を丸く */
        
        padding: 15px;
        /* 内部余白 */
        
        overflow-x: auto;
        /* 横にはみ出す場合はスクロール可能に */
        
        margin: 20px 0;
        /* 上下のマージン */
    }
    
    code {
        font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
        /* モノスペースフォント */
        
        font-size: 0.9em;
        /* やや小さめのフォントサイズ */
    }
    
    /* インラインコード */
    p code {
        background-color: #f8f9fa ;
        /* 背景色 */
        
        padding: 2px 4px;
        /* 内部余白 */
        
        border-radius: 3px;
        /* 角を丸く */
    }
    
    /* リンクスタイル */
    .docs-content a {
        color: #007bff ;
        /* リンク色(青) */
        
        text-decoration: none;
        /* 下線を削除 */
    }
    
    .docs-content a:hover {
        text-decoration: underline;
        /* ホバー時に下線を表示 */
    }
    

    ステップ3: レスポンシブ対応を追加

    /* レスポンシブ対応 - タブレット向け */
    @media (max-width: 900px) {
        .docs-container {
            flex-direction: column;
            /* サイドバーとメインコンテンツを縦に並べる */
        }
        
        .docs-sidebar {
            width: 100%;
            /* 幅を100%に */
            
            height: auto;
            /* 高さを自動に */
            
            position: relative;
            /* 固定位置解除 */
        }
        
        .docs-nav {
            display: flex;
            /* ナビゲーションアイテムを横並びに */
            
            flex-wrap: wrap;
            /* 折り返し可能に */
        }
        
        .docs-nav ul {
            display: flex;
            flex-wrap: wrap;
            gap: 5px;
            /* アイテム間の間隔 */
        }
        
        .language-switcher {
            margin-top: 20px;
            /* 上部マージン */
        }
        
        .language-switcher ul {
            display: flex;
            gap: 5px;
        }
        
        .docs-content {
            padding: 30px 20px;
            /* 余白を狭く */
        }
    }
    
    /* レスポンシブ対応 - スマートフォン向け */
    @media (max-width: 600px) {
        .docs-nav ul, .language-switcher ul {
            flex-direction: column;
            /* モバイルでは縦並びに戻す */
        }
        
        .docs-content h1 {
            font-size: 2rem;
            /* 見出しサイズ調整 */
        }
        
        .docs-content h2 {
            font-size: 1.5rem;
        }
        
        .docs-content h3 {
            font-size: 1.3rem;
        }
        
        .docs-lead {
            font-size: 1.1rem;
        }
        
        pre, code {
            font-size: 0.8rem;
            /* コードブロックのフォントサイズを小さく */
        }
    }
    

    シーン4: メールニュースレターのHTML版

    メールニュースレターでは特に互換性と安定したレイアウトが重要です。

    ステップ1: 基本HTMLの作成

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Monthly Newsletter - April 2025</title>
        <style>
            /* インラインスタイルは削除して、ここにスタイルをまとめています */
            /* 実際のメールでは、ほとんどのスタイルをインライン化する必要があります */
        </style>
    </head>
    <body style="margin: 0; padding: 0; background-color: #f5f5f5 ; font-family: Arial, sans-serif; color: #333333 ; line-height: 1.6;">
        <!-- メール全体のコンテナ -->
        <table width="100%" cellpadding="0" cellspacing="0" border="0" style="width: 100%; max-width: 600px; margin: 0 auto; background-color: #ffffff ;">
            <!-- メールヘッダー -->
            <tr>
                <td style="padding: 20px; text-align: center; background-color: #0066cc ;">
                    <!-- ロゴ -->
                    <img src="logo.png" alt="Company Logo" width="150" style="max-width: 100%;">
                    <!-- メールブラウザで画像が表示されない場合に備えてaltテキストを設定 -->
                </td>
            </tr>
            
            <!-- メールタイトル -->
            <tr>
                <td style="padding: 30px 20px 20px 20px; text-align: center;">
                    <h1 style="margin: 0; color: #333333 ; font-size: 24px; line-height: 1.2; margin-bottom: 10px;">
                        Monthly Newsletter: April 2025
                    </h1>
                    <p style="margin: 0; color: #666666 ; font-size: 16px;">
                        The latest updates and news from our company
                    </p>
                </td>
            </tr>
            
            <!-- メイン記事 -->
            <tr>
                <td style="padding: 0 20px 20px 20px;">
                    <h2 style="color: #0066cc ; font-size: 20px; margin-top: 30px; margin-bottom: 15px; border-bottom: 1px solid #eeeeee ; padding-bottom: 10px;">
                        Exciting New Product Launch
                    </h2>
                    <p style="margin: 0 0 15px 0; font-size: 16px; line-height: 1.5; word-wrap: break-word;">
                        We're thrilled to announce the launch of our new product, SuperProductExtravaganza, which will revolutionize how you interact with technology in everyday life.
                    </p>
                    <p style="margin: 0 0 20px 0; font-size: 16px; line-height: 1.5; word-wrap: break-word;">
                        Our team has been working tirelessly to bring you this groundbreaking innovation that combines artificial intelligence, sustainability, and user-friendly design.
                    </p>
                    
                    <!-- CTA ボタン -->
                    <table width="100%" cellpadding="0" cellspacing="0" border="0" style="margin-bottom: 30px;">
                        <tr>
                            <td>
                                <a href="https://example.com/product" style="display: inline-block; padding: 12px 24px; background-color: #0066cc ; color: #ffffff ; text-decoration: none; font-weight: bold; border-radius: 4px; font-size: 16px;">
                                    Learn More
                                </a>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            
            <!-- セカンダリコンテンツ -->
            <tr>
                <td style="padding: 0 20px 30px 20px;">
                    <h2 style="color: #0066cc ; font-size: 20px; margin-top: 20px; margin-bottom: 15px; border-bottom: 1px solid #eeeeee ; padding-bottom: 10px;">
                        Upcoming Events
                    </h2>
                    <table width="100%" cellpadding="0" cellspacing="0" border="0">
                        <tr>
                            <td style="padding: 10px 0; border-bottom: 1px solid #eeeeee ;">
                                <p style="margin: 0; font-weight: bold; font-size: 16px;">
                                    Annual Conference
                                </p>
                                <p style="margin: 5px 0 0 0; color: #666666 ; font-size: 14px;">
                                    May 15-17, 2025 • San Francisco, CA
                                </p>
                            </td>
                        </tr>
                        <tr>
                            <td style="padding: 10px 0; border-bottom: 1px solid #eeeeee ;">
                                <p style="margin: 0; font-weight: bold; font-size: 16px;">
                                    Webinar: Future Trends
                                </p>
                                <p style="margin: 5px 0 0 0; color: #666666 ; font-size: 14px;">
                                    June 5, 2025 • 10:00 AM PST
                                </p>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            
            <!-- フッター -->
            <tr>
                <td style="padding: 20px; text-align: center; background-color: #f8f8f8 ; font-size: 14px; color: #666666 ;">
                    <p style="margin: 0 0 10px 0;">
                        © 2025 Company Name. All rights reserved.
                    </p>
                    <p style="margin: 0 0 10px 0;">
                        <a href="https://example.com/unsubscribe" style="color: #0066cc ; text-decoration: none;">
                            Unsubscribe
                        </a> | 
                        <a href="https://example.com/preferences" style="color: #0066cc ; text-decoration: none;">
                            Update Preferences
                        </a>
                    </p>
                    <p style="margin: 0;">
                        Company Address, City, Country
                    </p>
                </td>
            </tr>
        </table>
    </body>
    </html>
    

    まとめ:英語サイト作成のベストプラクティス

    1. 言語属性の設定

      • 必ず <html lang="en"> を設定し、スクリーンリーダーや検索エンジンに言語情報を伝える

    2. テキストの折り返し処理

      • word-wrap: break-word; と overflow-wrap: break-word; で長い英単語に対応する

      • hyphens: auto; でハイフネーションを有効にし、読みやすさを改善する

    3. 適切な行長と行間

      • 英文は約60〜75文字(ch単位)の行長が最適

      • 行間は本文で1.5〜1.6、見出しで1.2〜1.3が推奨

    4. システムフォントスタックの活用

      • 各デバイスの最適なフォントを使用してパフォーマンスとデザイン性を両立

    5. レスポンシブ対応

      • 様々な画面サイズに適応するメディアクエリを設定

      • モバイルでは行間や余白を調整して読みやすさを確保

    6. 構造化マークアップ

      • セマンティックHTML要素(<article>, <section>, <header> など)を活用

      • アクセシビリティと検索エンジン最適化を意識

    これらの技術とテクニックを適切に組み合わせることで、日本語サイトを英語に変換する際の様々な課題を解決し、優れたユーザー体験を提供できます。英語テキストの特性を理解し、それに合わせた実装を心がけましょう。

    あなたへのおすすめ