代码
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/login.css" />
<title>无sdf</title>
</head><body>
<div class="container">
<div class="main">
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'login-form',
'enableClientValidation'=>true,
'clientOptions'=>array(
'validateOnSubmit'=>true,
),
)); ?>
<div class="row">
<?php echo $form->labelEx($model,'用户名'); ?>
<?php echo $form->textField($model,'username'); ?>
<?php echo $form->error($model,'username'); ?>
</div>

<div class="row">
<?php echo $form->labelEx($model,'密码'); ?>
&nbsp;&nbsp;<?php echo $form->passwordField($model,'password'); ?>
<?php echo $form->error($model,'password'); ?>
</div> <div class="row rememberMe">
<?php echo $form->checkBox($model,'rememberMe'); ?>
<?php echo $form->label($model,'记住我'); ?>
<?php echo $form->error($model,'rememberMe'); ?>
</div> <div class="row buttons">
<?php echo CHtml::submitButton('登录'); ?>
<?php echo CHtml::submitButton('取消')  ?>
</div> <?php $this->endWidget(); ?>
</div>
</div>
</div>
</body>
</html>
--css
body {
font-size:14px; 
margin: 0px;
font-family:"微软雅黑";
}.container{
margin-top:0px;
width:100%;
background-color:#6633CC;
}.main{
width:100%;
min-height:500px;
}.form{
padding-top:250px;
padding-left:850px;
}
--firefox dug 下
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body>
               //错误在这里  这里竟然有空白
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<link href="/park/css/login.css" type="text/css" rel="stylesheet">
<title>无sdf</title>
<div class="container">
</body>
</html>PHP

解决方案 »

  1.   

    上面贴的代码<meta 在body的上面,怎么下面贴的在body下面来了?
      

  2.   

    应该是这个原因,转换一下编码格式,一定用无BOM格式,我之前也遇到过这个问题,纠结了老久,无意中改了一下发现问题了
      

  3.   

    不是编码的问题  我用  notepad++改了编码格式依然  是有空白   还有 <meta>  标签还在 body里 。
      

  4.   

    给body设置{padding:0px;margin:0px}试试
      

  5.   

    css----body {
    padding:0px;
    font-size:14px; 
    margin: 0px;
    font-family:"微软雅黑";
    }.container{
    margin-top:0px;
    width:100%;
    background-color:#6633CC;
    }.main{
    width:100%;
    min-height:500px;
    }.form{
    padding-top:250px;
    padding-left:850px;
    }