實施例:http://www.jpeg.cz/images/2016/05/04/uEf8S.jpg字體大小相同元件寬度
喂,是有可能使font-size
相同width
作爲元件,並使其響應於或它必須被固定在每一分辨率?
HTML:
<h1>Lorem ipsum dolor!</h1>
<div id="form-wrapper">
<form action="#" method="post">
<input type="text" name="fullname" placeholder="Jméno a příjmení" />
<input type="email" name="email" placeholder="E-mail" />
<input type="tel" name="tel" placeholder="Telefon" />
<input type="submit" value="ODESLAT" />
</form>
</div>
CSS:
@media only screen and (max-width: 767px) {
section h1 {
font-size: xx;
}
#form-wrapper {
width: 320px;
}
}
@media (min-width: 768px) {
section h1 {
font-size: xx;
}
#form-wrapper {
max-width: 425px;
}
}
@media (min-width: 1200px) {
section h1 {
font-size: 50px;
font-size: 3.125rem;
}
/* form */
#form-wrapper {
max-width: 590px;
}
}
P [基於容器寬度的字體縮放]的可能副本(http://stackoverflow.com/questions/16056591/font-scaling-based-on-width-of-container) –