简体   繁体   中英

How to fix position an element but keep the height relative to browser window?

You probably noticed that some web sites have a feedback feature created with http://uservoice.com . It display's a badge on left or right of your screen.

But, how is that badge positioned? It looks like its position depends on the height of the browser....

Can you help me with how to create some sort of badge like this, with functionality to redirect me to the some other url?

tnx in adv!

It uses position: fixed on the a tag. It is using a top: 45% to get it to "move" with the window height.

Heres a cool example of css and JS for floating a link or menu!

JTricks Example!

Heres another example from JTricks thats more like what your looking for (fixedmenu not floating)

Another example!! =)

(shows legacy browser compatibility)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM