【问题标题】:css property not appyling for divcss属性不申请div
【发布时间】:2017-07-21 15:25:44
【问题描述】:

在下面的代码中,在 div 部分的成功和失败类中,字体颜色没有改变,并且 div 语句得到了下划线。 text-align 和 font-size 正确应用 css 成功和失败,请检查

  <html>
  <head>
   <meta charset="utf-8">
   <meta name="viewport" content="width=device-width, initial-scale=1">
   <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js">            </script>  
  <script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.1.1.min.js"></script>  
 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

 <style>

 td
 {
   height:40px;
 }
     select
     {
       spacing-left:50px;
     }
     .well-width
     {   
       height:400px;     
       border-radius:10px;     
       width:600px;        
      -webkit-box-shadow:0 0 20px grey;  
     }
     #title
     {
   font-weight:bold;
   font-size:38px;
   color:#f22144;
   font-family: 'Slabo 24px', serif;
     }
    #subtitle
    {
      color:green;
      font-size:25px;
      margin-left:80px;
      font-weight:bold;   
    }
    .success
    {
      text-align:center;
      font-size:25px;
      text-colour:green;
    }
    .fail
    {
      text-align:center;
      font-size:25px;
      colour: white;
      text-decoration: none;
      text-decoration-color: red;         
    }
       </style> 
     </head>
   <body>

     <div class="container">

       <br>
        <div class="well-width">    
         <br><Center><h1 style="color:green;font-family:'Arial Black';">       <u>GET RECEIPT<u></h1></center></br>
      <form method="post" action="#" autocomplete="off">   
        <center><table border=0>
         <tr>
             <td><label> Enter the Reference Number:</label></td>
             <td> <input type="text" name="ref" maxlength="10" required>  </td>
        </tr>
        <tr>
             <td><label> Enter Roll Number:</label></td>
             <td> <input type="text" name="roll" maxlength="10" required></td>
        </tr>

        <tr>
            <td colspan=2><center><input type="submit" name="submit" class="btn btn-info" value="Delete"></center></td>
        <tr>

         </table></center>
      </form>   
     </div>     
   </div>  
  <?php
if(isset($_POST['submit']))
{
  include('connect.php');
  $ref=$_POST['ref'];
  $roll=$_POST['roll'];

  $sql="select * from registrations where id='$ref' and rollno='$roll'";
  $query=mysql_query($sql);
  $count=mysql_num_rows($query);
  if($count>0)
  {
   $sql1="delete from registrations where id='$ref' and rollno='$roll'" ;
   $query1=mysql_query($sql1);
    if($query1)
    {
      echo"<div class='success'>$count records deleted successfully</div>";
    }       
  }
  else
  {
    echo"<div class='fail'>No records found with this Refrence Id and Rollno</div>";

  }
}
  ?>
 </body>
</html>

【问题讨论】:

    标签: css


    【解决方案1】:

    首先你的代码质量很差。看。请使用工具解决您的问题。

    【讨论】:

    • 那是真正的朋友。所有的问题都解决了。谢谢
    【解决方案2】:

    不是text-colour:green;,而是color: green;colour: white;,它是color: white;

    【讨论】:

    • 我建议你在创建项目时使用这个 normalize.css necolas.github.io/normalize.css 文件。它将帮助您消除许多奇怪的事情。尝试放入您的 .fail.successtext-decoration: none !important;
    • 要删除下划线,将此属性设置为失败和成功类。显示:内联块;这是由于某种原因,这个东西正在渲染。我认为你的代码中有一些问题。
    • 显示:内联块;在类中删除下划线但文本未居中
    • 这件事是因为你的代码。这就是为什么我们需要使用这种类型的代码。
    【解决方案3】:

    你在color 中有拼写错误,它的color 不是colour 所以这就是它不起作用的原因

    也没有使用 text-color 你使用 color 以便它工作

    试试这个

    color:green;  
    color:white;
    

    在您的css 代码中

    【讨论】:

      【解决方案4】:

      您在这里使用了错误的属性名称。

      而不是这个

      text-decoration-color: red;
      

      应该是

      color:red;
      

      对于成功

      而不是这个

      text-colour: green;
      

      应该是

      color: green;
      

      要更改字体颜色,请使用属性颜色。要更改背景颜色,请使用背景颜色。参考this tutorial

      要删除下划线,请将此属性设置为失败和成功类。

      显示:内联块;

      这是由于某种原因,这个东西正在渲染。我认为你的代码有问题。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2014-04-06
        • 1970-01-01
        • 2020-02-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多