设计一个浮动登录< div>问题 [英] design a floating login <div> issue
问题描述
任何人都可以指导我设计一个登录div,如ups.com。只需去www.ups.com并点击登录按钮,然后浮动登录div出现。如何生成这种类型的div。请尽可能帮助我。感谢
can anyone please guide me to design a login div like ups.com. just go to www.ups.com and click on login button then a floating login div appear. how to generate this type of div. please help me if possible. thanks
推荐答案
将位置设置为固定
或 absolute
,并设置 top
和 left
属性。看ups.com,他们使用这样的东西:
By setting position as fixed
or absolute
, and set top
and i.e. left
properties. Looking at ups.com they use something like this:
#loginform {position:absolute; left:409px; top:21px; width:270px; }
#loginform { position: absolute; left: 409px; top: 21px; width: 270px; }
在这之上,他们使用一个透明的gif箭头,然后一个div里面的灰色背景和边框的样式。
On top of this they use a transparent gif for the arrow and then a div inside with the styling of grey background and border.
编辑:
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
header { background: black; color: white; padding: 2em; }
#login { position: absolute; top: 5em;
background: #eee; border: solid 1px #999;
width: 200px; height: 200px; }
</style>
</head>
<body>
<header>
<button>Login</button>
<form id="login"></form>
</header>
</body>
</html>
当隐藏或显示表单时,我认为JamWaffles的帖子是好的。 jQuery是几种方法之一,但可能是更好的一种。如果不是最好的。 ;)
When it comes to hiding or showing the form I think JamWaffles post is good. jQuery is one of several ways to go, but probably one of the better. If not best. ;)
这篇关于设计一个浮动登录< div>问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!