我如何给与foreach一起获得的div提供保证金

时间:2015-12-10 17:16:21

标签: html css

我想检查是否给了我用foreach获得的div的保证金

echo "<div id='NotificationsDispl'><a href='main.php?u=".$initiator."'>
        <img title='".$initiator."' src='../img/".$_SESSION['pr']."' id='FromsPP'></a>
        <a id='NotificationFrom' href='main.php?u=$initiator'>".$initiator." Sent you a friend request</a>
        <form class='submitForm Rejecat' method='post' onSubmit='return false;' >
          <input value='Reject' type='submit' name='Reject' id='Reject'>
        </form>
        <form onSubmit='return false;' class='submitForm Accepta' method='post'>
            <input name='Accept' type='submit' id='Accept' value='Accept'>
        </form>
    </div>";

我有这个css代码

#NotificationFrom{
    margin-left: 125px;
    position: absolute;
    text-decoration: none;
    z-index: 102;
    color: black;
    margin-top:15px;
}
#NotificationsDispl{
    display: list-item;
    margin-top: 11px;
    padding: 25px;
    position: absolute;
}

但它没有用。

2 个答案:

答案 0 :(得分:0)

尝试:

<div class='notif_displ' id='NotificationsDispl'>

.notif_displ{
margin-top: 11px !important;
}

答案 1 :(得分:0)

根据jsfiddle,我累了复制你的代码。

<div id='NotificationsDispl'><a href='main.php?u=".$initiator."'>
    <img title='".$initiator."' src='../img/".$_SESSION['pr']."' id='FromsPP'></a>
    <a id='NotificationFrom' href='main.php?u=$initiator'>".$initiator." Sent you a friend request</a>
    <form class='submitForm Rejecat' method='post' onSubmit='return false;' >
      <input value='Reject' type='submit' name='Reject' id='Reject'>
    </form>
    <form onSubmit='return false;' class='submitForm Accepta' method='post'>
        <input name='Accept' type='submit' id='Accept' value='Accept'>
    </form>
</div>



#NotificationFrom{
        margin-left: 125px;
        position: absolute;
        text-decoration: none;
        z-index: 1;
        color: black;
        margin-top:15px;
    }
    #NotificationsDispl{
        display: list-item;
        margin-top: 11px;
        padding: 25px;
        position: absolute;
    }

点击此链接https://jsfiddle.net/p025mpbg/

因此,如果未应用CSS更改,

执行以下操作:

<强> 1。通过右键单击或按f12

检查网站上的元素

<强> 2。检查造型。您正在使用的不同文件中的CSS必须被覆盖且您的更改未被应用。