2013-03-29 71 views
0

大家好!我很长一段时间的Web开发人员和设计师,但这个让我傻眼了。我有一个关闭按钮(这不是Bootstrap)。它显示了优良的主页上:如何正确定位关闭按钮

enter image description here

但是,当我把相同的警报提交页面上,它会向下移动关闭按钮:

enter image description here

任何想法?这里是我的HTML:

<div class="alert"> 
    <div class="alertContents"> 
     When you submit yo stuff, it comes up in the feed right away. 
     <div class="alertClose">&times;</div> 
    </div> 
</div> 

和CSS:

.alert { 
    width: 100%; 
    background-color: #DD7474; 
    font-family: 'Raleway', sans-serif; 
    font-size: 18px; 
    color: #FBFBFC; 
    margin: auto; 
    border-radius: 2px; 
    border-color: transparent; 
    border-width: 0px; 
    border-style: solid; 
} 
.alertContents { 
    padding-top: 4px; 
    padding-bottom: 4px; 
    padding-left: 10px; 
    padding-right: 10px; 
} 
.alertClose { 
    float: right; 
    width: auto; 
    height: auto; 
    color: #FBFBFC; 
    cursor: hand; 
} 

谢谢!

+2

你会介意设置一个小提琴吗? – Brad

+0

你有没有看过一个Web检查器,看看提交页面上是否有新的元素,并且可能将它移下来? – dev

+0

@vletech是的,我有。这很古怪。 –

回答

0

我会用:

position: absolute; 

,然后添加在

left: 250px; 

编辑:这些代码添加到你的CSS ...喔,并回头看发生了什么事,也许你可以确保有一个:

clear: both; 

功能,如:

<div class="clear"></div> 

<br clear="all" /> 
+1

添加哪里,使用哪里?请编辑你的答案。 –

+0

@TehJamDude我尝试使用绝对定位,但它搞砸了我的设计的资源。 –

+0

使用警报框前后的清除功能...也许您可以显示更多的页面,这将帮助我们找到问题。 – Fearless