不能使宽度大于200px

时间:2015-02-26 14:26:47

标签: css asp.net-mvc-5

我有一个文本框和textarea,我希望增加宽度。我不能使宽度大于默认值,但我可以减少它。默认宽度约为200px

以下是控件的代码:

@foreach (var item in Model)
{
    <tr>
        ...
        <td>
            @Html.DisplayFor(modelItem => item.NoteTextViewModels.First().ContextIdentifier, new { @class = "timeAndNote" })
        </td>
...

和css:

.timeAndNote{
       width: 500px;
   }

我正在使用JQuery对话框来显示数据:

<div id="noteDialogDiv" style="display: none;"></div>

和JS功能:

function showDetailedImage(divId, dialogTitle) {
var target = '#' + divId;
$(target).attr("title", dialogTitle);

var dialog = $(target).dialog({
        show: "clip",
        hide: "clip",
        height: $(window).height() / 3,
        width: $(window).width() / 3 ,
        title: dialogTitle,
        modal:true,
        buttons: {
            Ok: function () {
                $(this).dialog("close");
            }
        }
});
dialog.dialog('open');

}

是否有一些我不知道的事情会阻止用户在某些场合中增加某些控件的宽度?

我添加了一个图像,其中有2个箭头指向我想要更宽的控件: enter image description here

2 个答案:

答案 0 :(得分:8)

如果我不得不猜测,我说最大宽度实际上是280px。我猜是因为默认MVC项目模板生成的Site.css文件具有以下样式定义:

/* Set width on the form input elements since they're 100% wide by default */
input,
select,
textarea {
    max-width: 280px;
}

删除它,你应该是好的。无论是谁为MVC 5做了示例模板都是懒惰的,并采用了一种快捷方式使默认表单看起来很好,而不是实际使用Bootstrap网格。

答案 1 :(得分:1)

就像Chris Pratt所提到的那样,问题是控件上有一个最大宽度。我尝试添加:max-width: 600px,然后就可以了。

非常感谢所有输入人员。谢谢克里斯

相关问题