Css 引导警报右边缘问题?
我正在MVC应用程序中使用引导警报。当警报出现时,它取左边距,但在右边不取边距 我没有做任何修改css,不确定它是正确的和默认的边缘。 这是我的密码:Css 引导警报右边缘问题?,css,asp.net-mvc,twitter-bootstrap,twitter-bootstrap-3,Css,Asp.net Mvc,Twitter Bootstrap,Twitter Bootstrap 3,我正在MVC应用程序中使用引导警报。当警报出现时,它取左边距,但在右边不取边距 我没有做任何修改css,不确定它是正确的和默认的边缘。 这是我的密码: <div class="alert alert-block alert-error"> <button type="button" class="close" data-dismiss="alert">×</button> It is a test error messag
<div class="alert alert-block alert-error">
<button type="button" class="close" data-dismiss="alert">×</button>
It is a test error message. It is test error message.
It is a test error message. It is test error message.
It is a test error message. It is test error message.
It is a test error message. It is test error message.
It is a test error message. It is test error message.
</div>
&时代;
这是一条测试错误消息。这是测试错误消息。
这是一条测试错误消息。这是测试错误消息。
这是一条测试错误消息。这是测试错误消息。
这是一条测试错误消息。这是测试错误消息。
这是一条测试错误消息。这是测试错误消息。
我试着把这个放在一个div里
我尝试了什么?
我尝试将此代码放在一个div中,并在外部div上应用。输入append
。作为结果,警报会自动为某个部分闪烁并隐藏,屏幕上的剩余内容如下:
我需要什么帮助?
你们能指导我如何使左边和右边的边距相等吗?在引导程序中有默认的类吗
编辑
我知道我可以将这个div集中在我的
固定宽度
和设置边距:auto
中,但问题是固定宽度是否仍然有效,因为这是使用引导的基本目的?我不确定修改哪些样式应该修改,哪些不应该修改。将整个div居中,这将自动提供正确的页边距:
<div class="alert alert-block alert-error" style="width:800px margin: 0 auto;">
如果白色外框的宽度为1000px,则每侧的边距为100px。正确的代码为:
<div class="alert alert-block alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
It is a test error message. It is test error message.
It is a test error message. It is test error message.
It is a test error message. It is test error message.
It is a test error message. It is test error message.
It is a test error message. It is test error message.
</div>
&时代;
这是一条测试错误消息。这是测试错误消息。
这是一条测试错误消息。这是测试错误消息。
这是一条测试错误消息。这是测试错误消息。
这是一条测试错误消息。这是测试错误消息。
这是一条测试错误消息。这是测试错误消息。
边距/填充应用于父div,而不是警报div本身
由于您使用的是引导,您可以使用他们的网格系统来保持设计的响应性,例如:
<div class="alert alert-block alert-error col-xs-12 col-sm-6 col-sm-push-3">
<button type="button" class="close" data-dismiss="alert">×</button>
It is a test error message. It is test error message.
...
</div>
&时代;
这是一条测试错误消息。这是测试错误消息。
...
我还添加了类文本中心,以使其在短文本的情况下看起来更好 谢谢,固定宽度和设置边距,它会保持响应吗?我关心的是使用引导的目的是,它是响应性的。我不确定我应该做什么样的css修改?您可以尝试将宽度设置为一个百分比,然后设置边距