左边距 css 无效
Margin-left css not working
我正在使用 jquery 日期选择器,我将日期选择器添加到我的 jsp 页面,我想将它向左移动,但它不起作用..
在我的 jsp 页面中,我有
<div id="datepicker" class="datepicker">
<script>
$("#datepicker").datepicker();
</script>
</div>
在我的 css 文件中有
.datepicker{
margin-top:20px;
margin-left:600px;
position: fixed;
}
但是元素总是在左上角。有人对此有解决方案吗?当我想定位元素时,我总是使用 margin-top 和 margin-left,并且它总是有效。提前致谢!
我在 codepen 上将日期选择器函数设置为 运行 时遇到问题,但 CSS 格式化部分工作正常:https://codepen.io/anon/pen/OWdXKL
<style>
.datepicker{
margin-top:20px;
margin-left:600px;
position: fixed;
};
</style>
<div id="datepicker" class="datepicker">this div is 600 px from the left; 20 px from the top</div>
<script>
$( "#datepicker" ).datepicker();
</script>
我的猜测是您的样式表中的其他地方覆盖了您提供的片段中定义的边距。
我正在使用 jquery 日期选择器,我将日期选择器添加到我的 jsp 页面,我想将它向左移动,但它不起作用..
在我的 jsp 页面中,我有
<div id="datepicker" class="datepicker">
<script>
$("#datepicker").datepicker();
</script>
</div>
在我的 css 文件中有
.datepicker{
margin-top:20px;
margin-left:600px;
position: fixed;
}
但是元素总是在左上角。有人对此有解决方案吗?当我想定位元素时,我总是使用 margin-top 和 margin-left,并且它总是有效。提前致谢!
我在 codepen 上将日期选择器函数设置为 运行 时遇到问题,但 CSS 格式化部分工作正常:https://codepen.io/anon/pen/OWdXKL
<style>
.datepicker{
margin-top:20px;
margin-left:600px;
position: fixed;
};
</style>
<div id="datepicker" class="datepicker">this div is 600 px from the left; 20 px from the top</div>
<script>
$( "#datepicker" ).datepicker();
</script>
我的猜测是您的样式表中的其他地方覆盖了您提供的片段中定义的边距。