Dodatkowe miejsce pod textarea, różni się w przeglądarkach
Pod tagiem textarea jest trochę miejsca. Od 1 do 4 pikseli w różnych przeglądarkach. Znacznik jest bardzo prosty:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<style>
body {
margin: 0;
padding: 0;
}
.main {
background-color: red;
}
textarea {
background-color: gray;
resize: none;
margin: 0;
border: 0 none;
padding: 10px;
height: 50px;
overflow: hidden;
}
</style>
</head>
<body>
<div class="main">
<textarea></textarea>
</div>
</body>
</html>
Oto jak jest renderowany w przeglądarkach:
Dlaczego tak się dzieje? Jak usunąć tę dodatkową przestrzeń? 59
2 answers
Dodaj vertical-align: top
do textarea
.
Powodem luki jest to, że textarea
jest elementem inline
(lub inline-block
), a luka jest spacją zarezerwowaną dlaPotomków w tekście. Nie wiem dokładnie, dlaczego różnica jest między różnymi przeglądarkami.
154
Author: thirtydot,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2011-08-22 08:43:48
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2011-08-22 08:43:48
W moim przypadku odpowiedź thirtydot nie zadziałała dobrze z dolną granicą rodzica <div>
.
display: block
ale ładnie mi pasowało.
10
Author: André Chalella,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-11-06 03:20:22
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-11-06 03:20:22