TinyMCE 不会居中
无论我尝试做什么,我都无法让我的tinyMCE文本编辑器正确居中。
这是标记:
<div id="container">
<form method="POST" id="tiny_mce"><div class="title">YOUR POSTING</div><br>
Title:<br />
<input type="text" name="title" /><br /><br />
Your words:<br />
<textarea name="words" class="tinymce" cols="30" rows="10"></textarea>
<br /><br />
<input type="submit" name="submit" value="SUBMIT" />
</form>
</div>
CSS:
*{
margin: 0;
padding: 0;
}
body,html{
margin:0 auto;
}
#container{
width:1200px;
border:0px solid black;
height:600px;
margin:0 auto;
}
#tiny_mce{
display:block !important;
float:left;
margin-left:auto;
margin-right:auto;
}
#tiny_mce input{
float:left;
}
No matter what I try to do, I can't get my tinyMCE text editor to center properly.
here's the markup:
<div id="container">
<form method="POST" id="tiny_mce"><div class="title">YOUR POSTING</div><br>
Title:<br />
<input type="text" name="title" /><br /><br />
Your words:<br />
<textarea name="words" class="tinymce" cols="30" rows="10"></textarea>
<br /><br />
<input type="submit" name="submit" value="SUBMIT" />
</form>
</div>
CSS:
*{
margin: 0;
padding: 0;
}
body,html{
margin:0 auto;
}
#container{
width:1200px;
border:0px solid black;
height:600px;
margin:0 auto;
}
#tiny_mce{
display:block !important;
float:left;
margin-left:auto;
margin-right:auto;
}
#tiny_mce input{
float:left;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需删除
float:left
并为 tiny_mce 提供 width 即可。它会起作用的。http://jsfiddle.net/Nw8SJ/
Just remove
float:left
and give width to the tiny_mce. It will work.http://jsfiddle.net/Nw8SJ/
这是由于浮动+没有宽度的奇怪组合。您试图将一个您希望完全位于左侧的对象居中,这与彼此直接冲突。另外,您的 #tiny_mce CSS 没有宽度,因此左右边距的自动自动功能将不起作用,因为浏览器不知道块元素有多大。删除浮动并添加宽度将使您的tiny_mce居中。
This is due to the strange combination of your floating + having no width. You are trying to center an object which you wish to be entirely to the left, this is in direct conflict with each other. Also your #tiny_mce CSS has no width thus the auto-auto on left and right margins won't work since the browser doesn't know how big the block element will be. Removing the float and adding a width will center your tiny_mce.