为什么在文本框的中间?这可能真的很简单,但我无法弄清楚
<div class="wrap-input100 bg1">
<span class="label-input100">Mensagem (Editável)</span>
<textarea id='mensagem' style="height:200px;" class="input100" type="text" name="mensagem">
<?php
$time = date("H");
$timezone = date("e");
if ($time < "12") {
echo "Bom Dia";
} else if ($time >= "12" && $time < "17") {
echo "Boa Tarde";
} else if ($time >= "19") {
echo "Boa Noite";
}
?>
</textarea>
</div>
问题不是出在班上,因为我删除了它,反正它在中间
答案 0 :(得分:2)
您的HTML
中有空格。这在文本区域中得到说明。
一种解决方案是将输出存储在变量中,并删除空白,例如
<?php
$time = date("H");
$timezone = date("e");
$output = '';
if ($time < "12") {
$output = "Bom Dia";
} else if ($time >= "12" && $time < "17") {
$output = "Boa Tarde";
} else if ($time >= "19") {
$output = "Boa Noite";
}
?>
<textarea id='mensagem' style="height:200px;" class="input100" name="mensagem"><?php echo $output; ?></textarea>
答案 1 :(得分:1)
<div class="wrap-input100 bg1">
<span class="label-input100">Mensagem (Editável)</span>
<?php
$time = date("H");
$timezone = date("e");
if ($time < "12") {
$text = "Bom Dia";
} else if ($time >= "12" && $time < "17") {
$text = "Boa Tarde";
} else if ($time >= "19") {
$text = "Boa Noite";
}
?>
<textarea id='mensagem' style="height:200px;" class="input100" name="mensagem"><?= $text ?></textarea>
</div>
尝试一下
答案 2 :(得分:0)
您可以尝试以下方法:
DatabaseModel db = new DatabaseModel();
var val = db.Members
.FirstOrDefault(b => b.Name == "Yordan");
db.Entry(val).State = EntityState.Detached;
var val2 = new Player(val);
val2.Name = "Frank";
db.Members.Update(val2);
db.SaveChanges();
答案 3 :(得分:0)
这是由于span标签。使用div代替tag并添加CSS。看到这个
<div class="wrap-input100 bg1">
<div class="label-input100" style="float:left; margin-right: 5px;">Mensagem (Editável)</div>
<textarea id='mensagem' class="input100" style="height:200px; width:40% " type="text" name="mensagem">
<?php
$time = date("H");
$timezone = date("e");
if ($time < "12") {
echo "Bom Dia";
} else if ($time >= "12" && $time < "17") {
echo "Boa Tarde";
} else if ($time >= "19") {
echo "Boa Noite";
}
?>
</textarea>
</div>
答案 4 :(得分:-1)
您必须在页面上对其进行检查。右键单击Bom Dia,然后单击检查元素,然后检查其为何居中。可能是因为您输入了100类,还是因为textarea样式。您需要相应地修改它的css。