/
index.html
189 lines (162 loc) · 5.8 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=960, initial-scale=1.0"/>
<title>CSSでの文章の折り返し指定 - ICS</title>
<style>
body {
font-family: sans-serif;
background-color: #f9f9f9;
padding-left: 32px;
padding-right: 32px;
}
#app {
margin: 0 auto;
}
.wrap {
display: flex; /* 突き抜けの事情もあり、GridでなくFlexboxで */
flex-wrap: wrap;
gap: 32px;
}
.item {
width: calc((100% - 64px) / 3);
padding: 16px;
box-sizing: border-box;
border-radius: 8px;
background-color: #eee;
}
.code {
font-family: Menlo, monospace;
font-weight: bold;
font-size: 1.4rem;
}
.code-prop {
color: #2549cc;
}
.code-colon {
color: #0f0f0f;
}
.code-value {
color: #377b2a;
}
.column-2 {
display: flex;
gap: 16px;
}
.column-2-first {
flex-shrink: 0;
width: 50%;
}
.column-2-second {
/* min-width: 0; */
}
</style>
</head>
<body>
<div v-for="o in list">
<div id="app">
<h1>CSSでの文章の折り返し指定</h1>
<h2 id="overflow-wrap">overflow-wrap</h2>
<div class="wrap">
<div v-for="o in listOverflowWrap" class="item">
<div v-bind:style="{ overflowWrap: o }">
<p class="code"><span class="code-prop">overflow-wrap</span><span class="code-colon">:</span> <span
class="code-value">{{ o }};</span></p>
<p><a href="#">{{sentenceUrl}}</a></p>
<p>{{sentenceJa}}</p>
<div class="column-2">
<!-- 幅固定 -->
<p class="column-2-first">{{sentenceEn}}</p>
<!-- ここに違いがでる -->
<p class="column-2-second">{{sentenceUrl}}</p>
</div>
</div>
</div>
</div>
<h2 id="word-break">word-break</h2>
<div class="wrap">
<div v-for="o in listWordBreak" class="item">
<div v-bind:style="{ wordBreak: o }">
<p class="code"><span class="code-prop">wordBreak</span><span class="code-colon">:</span> <span
class="code-value">{{ o }};</span></p>
<p>{{sentenceJa}}</p>
<p><a href="#">{{sentenceUrl}}</a></p>
<p>{{sentenceEn}}</p>
</div>
</div>
</div>
<h2 id="line-break">line-break</h2>
<div class="wrap">
<div v-for="o in listLineBreak" class="item">
<div v-bind:style="{ lineBreak: o }">
<p class="code"><span class="code-prop">line-break</span><span class="code-colon">:</span> <span
class="code-value">{{ o }};</span></p>
<p>{{sentenceJa}}</p>
</div>
</div>
</div>
<h2 id="hyphens">hyphens</h2>
<div class="wrap">
<div v-for="o in listHypens" class="item">
<div v-bind:style="{ hyphens: o }">
<p class="code"><span class="code-prop">hyphens</span><span class="code-colon">:</span> <span
class="code-value">{{ o }};</span></p>
<p lang="en">{{sentenceEn}}</p>
</div>
</div>
</div>
<h2>word-break と overflow-wrap の組み合わせ</h2>
<div class="wrap">
<div v-for="o in listMatrix" class="item">
<div v-bind:style="{ wordBreak: o.wordBreak, overflowWrap: o.overflowWrap }">
<p class="code"><span class="code-prop">word-break</span><span class="code-colon">:</span> <span
class="code-value">{{ o.wordBreak }};</span> <br/><span class="code-prop">overflow-wrap</span><span
class="code-colon">:</span> <span class="code-value">{{ o.overflowWrap }};</span></p>
<p>{{sentenceJa}}</p>
<p><a href="#">{{sentenceUrl}}</a></p>
<p>{{sentenceEn}}</p>
</div>
</div>
</div>
</div>
</div>
<script type="module">
import {createApp, ref} from "https://unpkg.com/vue@3.2.4/dist/vue.esm-browser.prod.js";
const app = createApp({
setup() {
const listWordBreak = ["normal", "break-all", "keep-all"];
const listOverflowWrap = ["normal", "break-word", "anywhere",];
const listLineBreak = ["auto", "anywhere", "strict",];
const listHypens = ["none", "auto", "manual",];
const listMatrix = [];
for (let o1 of listWordBreak) {
for (let o2 of listOverflowWrap) {
listMatrix.push({
wordBreak: o1,
overflowWrap: o2,
})
}
}
const sentenceJa = `この文章は、テキストの折り返しポイントを確認するために用意しました。ブラウザの幅を調整して、折り返しがどのように発生するか観察してみてください。とくに、カギ括弧や読点などの特定の文字が折り返し位置にどのように影響するかに注目してください。例えば、「桜がぁ、咲いたよぉ」「やぁ、元気かい?」「日々是精進」というフレーズを見てみましょう。では、この文章の最初にどのような文字が表示されるか、確認してみてください。`;
const sentenceUrl = "https://example.com/document/abcdefghijklmnopqrstuvwxyz1234567890"
const sentenceEn = `This manuscript is intentionally constructed to facilitate the examination of textual line-break
peculiarities within varying browser dimensions. By manipulating the horizontal expansiveness of your
viewing portal, one can meticulously observe the manifestation of distinct line-break junctures. What character, pray tell,
inaugurates this textual composition?`;
return {
listWordBreak,
listOverflowWrap,
listLineBreak,
listHypens,
listMatrix,
sentenceJa,
sentenceUrl,
sentenceEn
};
},
});
app.mount("#app");
</script>
</body>
</html>