English 中文(简体)
CSS 不同的浏览器代表不同的输出
原标题:CSS different browser means different output
  • 时间:2012-05-25 19:37:49
  •  标签:
  • css
  • browser

我有一个问题 我的CSS。

When I open my page on IE and Firefox it shows up like this (just like it should) http://tinypic.com/r/14ni5gk/6

But when I open my page on Safari it shows up like this: http://tinypic.com/r/2mzdxed/6

(注意到最后两盒没有漂浮在彼此旁边)

我有以下CS代码:

@charset "utf-8";

body{
    font-family:Verdana, Geneva, sans-serif;
    font-size: 12px;
}

#container{
    width: 600px;
    background: #fff;
}

#header{
    height: 151px;
    background-image:url( ../img/tomaat.png );
    background-repeat: no-repeat;
    background-position:center; 
}

#recent fieldset{
    width : 600px;
}

#stats fieldset{
    width : 600px;
}

#login fieldset{
    width : 200px;
    float: left;
    height: 150px;
}

#nieuw fieldset{
    width : 290px;
    float:left; 
    height: 100px;
}

#verwijder fieldset{
    width: 289px;
    height:100px;
}

label {
    width: 50px;
    float: left;
}

#login label{
    width: 200px;
    float: left;
}

input {
    width: 200px;
}

#nieuw button{
    position:relative;
    top: 5px;
}

#verwijder button{
    position:relative;
    top: 27px;
}

#login button{
    width: 200px;
    position: relative;
    top:5px;
}

#a {
    position : relative;
    top: 43px;
}
#buttonz {
    text-align: center;
}

legend{
    font-weight: bold;
}

以下索引.php页面:

<?php
    include_once("db.php"); 
    session_start();
    if (!isset($_SESSION[ uid ])){ 
        header("location:main_login.php");
        exit();
    }
    if (!isset($_SESSION[ upass ])){ 
        header("location:main_login.php");
        exit();
    }
    $sql="SELECT * FROM users WHERE Naam= ".$_SESSION[ uid ]."  AND Wachtwoord= ".$_SESSION[ upass ]." ";
    $result=mysql_query($sql);
    $count=mysql_num_rows($result);
    if($count < 1){
        header("location:main_login.php");
        exit();
    }

?>


<?php
    $date = date("y-m-d");
    $vandaag = mysql_query("SELECT Type, Naam, Reden, Door FROM turfjes WHERE turfjes.Datum =  " . $date . " ");
    $names = mysql_query("SELECT Naam From users");
    $names2 = mysql_query("SELECT Naam From users");
    $names3 = mysql_query("SELECT Naam From users");
?>


<!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>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Tomaten turfjes pagina | 258</title>
        <link rel="stylesheet" type="text/css" href="css/style.css" media="all" /> 
        <script type="text/javascript" src="js/jquery.js"></script>
        <script>
            jQuery.noConflict();
        </script>
        <script src="js/prototype.js" type="text/javascript"> </script>
        <script src="js/scriptaculous.js" type="text/javascript"></script>
        <script src="js/script.js" type="text/javascript"> </script>
    </head>

    <body>
        <div id="container">
            <div id="header">
            </div>
            <div id="info">
                <div id="recent">               
                    <fieldset>
                        <legend>Vandaag</legend>
                        <table border="0">
                            <tr>
                            <td>Type</td>
                            <td>Naam</td>
                            <td>Reden</td>
                            <td>Door</td>
                            <?php
                                while($a = mysql_fetch_array($vandaag)){
                            ?>      <tr>
                                    <td><?php echo($a[ Type ]);?></td>
                                    <td><?php echo($a[ Naam ]);?></td>
                                    <td><?php echo($a[ Reden ]);?></td>
                                    <td><?php echo($a[ Door ]);?></td>
                                    </tr>
                            <?php
                                } 
                            ?>
                        </table>
                    </fieldset>
                </div>
                <div id="stats">                
                    <fieldset>
                        <legend>Turfjesteller</legend>
                        <table border="0">
                            <tr>
                            <td>Naam</td>
                            <td>Aantal</td>
                            <td>Gedaan</td>
                            <td>Resterend</td>
                            </tr>
                            <?php
                                while($r = mysql_fetch_array($names)){
                                echo("<tr id=".$r[ Naam ].">");
                            ?>
                                    <td><?php echo($r[ Naam ]);?></td>
                            <?php 
                                        $sql="SELECT * FROM turfjes WHERE Naam= ".$r[ Naam ]."  AND Type= Adtje ";
                                        $result=mysql_query($sql);
                                        $count=mysql_num_rows($result); //count = adtjes
                                        $sql2="SELECT * FROM turfjes WHERE Naam= ".$r[ Naam ]."  AND Type= Turfje ";
                                        $result2=mysql_query($sql2);
                                        $count2=mysql_num_rows($result2); //count2 = turfje     
                            ?>
                                    <td><?php echo($count2);?></td>
                                    <td><?php echo($count);?></td>
                                    <td><?php echo($count2-$count);?></td>
                                    </tr>
                            <?php 
                                }
                            ?>
                        </table>
                    </fieldset>
                </div>
            </div>
            <div id="actie">
                <div id="nieuw">
                    <fieldset>
                    <legend>Nieuwe turfjes</legend>
                        <label>Naam</label>
                        <select id = "naamnieuw">
                            <option value="" selected></option> 
                            <?php
                                while($r = mysql_fetch_array($names2)){
                                    echo("<option value= ".$r[ Naam ]." >".$r[ Naam ]."</option>");
                                }
                            ?>
                        </select>
                        <br>
                        <label>Reden</label> <input type="text" name="redennieuw" id="redennieuw"/>  <br>
                        <label>Door</label> <input type="text" name="door" id="door" disabled="disabled" value =<?php echo($_SESSION[ uid ]) ?>> <br>
                        <div id = "buttonz"><button type="button" id="submitnieuw">Turfje uitdelen</button></div>
                    </fieldset>
                </div>
                <div id="verwijder">
                    <fieldset>
                    <legend>Verwijderen turfjes</legend>
                        <label>Naam</label>                     
                        <select id = "naamverwijder">
                            <option value="" selected></option> 
                            <?php
                                while($r = mysql_fetch_array($names3)){
                                    echo("<option value= ".$r[ Naam ]." >".$r[ Naam ]."</option>");
                                }
                            ?>
                        </select>
                        <br>
                        <label>Door</label> <input type="text" name="door" id="door2" disabled="disabled" value =<?php echo($_SESSION[ uid ]) ?>> <br>
                        <div id = "buttonz"><button type="button" id="submitdelete">Turfje verwijderen</button></div>
                    </fieldset>
                </div>
                <form name="logout" method="post" action="logout.php">
                <div id = "buttonz"><input type="submit" name="logout" value="Log uit"></div>
                </form>
            </div>
        </div>
    </body>
</html>

The boxes are both in the div action and are called nieuw and verwijder. Nieuw is the first one, verwijder is the second one.

有人能告诉我为什么会发生这种事吗? 甚至可以告诉我如何解决这个问题?

最佳回答

浏览器对于某些元素(例如UL上的粘贴或H1的大小)的贴贴、边距和字体大小等事物,有略微不同的默认设置。

CSS 重置重置清除这些, 这样您就可以使用自己的值 。

周围有很多。 我喜欢 < a href=" "http:// developmenter.yahoo.com/yui/reset/" rel="nofollow" > Yahoo CSS Reset 2 , HTML5 则有 < a href=" http://html5boilerplate.com/" rel="nofollow" >HTML5 Boilerplet 。

问题回答

暂无回答




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

Drop down background url in Safari Issue

selectBox.selectCSS { background: url(/Images/replacementSelectBackground.png) top left no-repeat height:auto; } I have an issue in Safari only where the image is not rendering on top ...

CSS specific for Safari

How do you target specifically safari in css with styles?

Aligning textarea in a form

Ive used the following css code to align my form elements: form { position:relative; } form input { position:absolute; left:11em; } However, the textarea element is not aligned correctly with the ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

CSS problem with page footer

I have defined my page footer in the css file as: #footer { position: absolute; height: 50px; text-align: center; background: #66CCCC; bottom: 0px; left: 0px; width: 100%; height: ...

热门标签