我将div的宽度设置为窗口的100%.当我对此div应用边框时,右边框被切断.我是否必须对此进行盒子模型破解?
#textBoxContainer {
width:100%;
height:30%;
position:fixed;
z-index:99;
bottom:0px;
left:0px;
background-color:#999;
border: 4px solid #000;
}Run Code Online (Sandbox Code Playgroud)
<div id="textBoxContainer"></div>Run Code Online (Sandbox Code Playgroud)
我想box-sizing: border-box为div标签.
对于Mozila Firefox,我试过了
-moz-box-sizing: border-box;
Run Code Online (Sandbox Code Playgroud)
对于IE(Internet Explorer),我已经尝试过以下两种方式
-ms-box-sizing: border-box;
box-sizing: border-box;
Run Code Online (Sandbox Code Playgroud)
但它无法在IE(Internet Explorer)中运行.虽然我申请 box-sizing: border-box;了Internet Explorer,但它增加了边框和填充元素的宽度.为什么会这样?
应该是什么问题?请帮助和消化我.
注意:我使用的是Internet Explorer8和Windows7终极版
页面代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MainPage.aspx.cs" Inherits="MainPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="x-ua-compatible" content="IE=8"/>
<title></title>
<style type="text/css">
*
{
box-sizing: border-box; /*it gives error:Validation (CSS 2.1): 'box-sizing' is not a known CSS property name. …Run Code Online (Sandbox Code Playgroud) 
尝试了几个方法:*将外部div作为display:table和其他所有元素作为display:table-cell.*通过使用jquery窗口调整大小来计算搜索的宽度.但是当单击窗口调整大小按钮时,它的宽度不是应该的.
任何人都知道如何使用纯CSS/CSS3或如果不是通过jquery实现此导航?
欣赏你的想法,帮助......
我是第一次使用CSSLint并立即尝试.当我写下面的CSS
.div {
box-sizing: border-box;
border: 1px solid red;
padding: 5px;
width: 100px;
}
Run Code Online (Sandbox Code Playgroud)
然后当我跑 Warning - The box-sizing property isn't supported in IE6 and IE7.
我也改变了"box-sizing": false对"box-sizing": true我的.csslintrc文件.
但我仍然得到这个警告.我怎么解决这个问题?