我希望数字1-9在红色框中一起刷,因为浏览器宽度变小(所有数字都可见)。但是,当浏览器宽度减小时,只会出现前几个数字。
https://codepen.io/anon/pen/oZdeQX
void removeExtraWhitespace(char *src, char *dst) {
for (; *src; ++dst, ++src) {
*dst = *src;
if (*src == '\n' || *src == '\t') {
*src = ' ';
}
else if (isspace(*src)) {
while (!isspace(*(src + 1))) {
++src;
}
}
}
*dst = '\0';
}
.hi {
background: #ff0000;
height: 2em;
width: 5em;
}
答案 0 :(得分:0)
使用css自动换行属性。将以下内容添加到您的CSS中。
.hi p {
word-wrap: break-word;
}
答案 1 :(得分:0)
我认为media queries正是您所寻找的。基本上,您要为不同的媒体(例如屏幕)尺寸设置断点,例如:
How many students do you want to add?: 2
Student Name: r1
Student Grade: 1
Student Name: r2
Student Grade: 2
Whose mark's would you like to see?: r1
nAccording to this data this student has a 0.0% average
Who are you adding a mark(s) for?: r1
Enter mark: 25
Whose mark's would you like to see?: r1
nAccording to this data this student has a 25.0% average
您可以使用.hi {
font-size: 16px;
}
@media (max-width: 600px) {
.hi {
font-size: 12px;
}
}
@media (max-width: 480px) {
.hi {
font-size: 10px;
}
}
,min-width
,max-width
,min-height
,max-height
,将这些选项和其他许多选项结合使用。