/    Sign up×
Community /Pin to ProfileBookmark

DIV Fixed to Top of Screen

I have a DIV element which I want to remain at the top of the screen, even if the user scrolls down. I’ve done everything I think, but it still does not seem to be working.

Here is an example of my current setup:
[URL=”http://games.pluginstudios.co.uk”]Example[/URL]

to post a comment
CSS

4 Comments(s)

Copy linkTweet thisAlerts:
@aj_nscJul 03.2011 — CSS:
<i>
</i>position: fixed;
width: 100&amp;#37;;
Copy linkTweet thisAlerts:
@EpicKrisauthorJul 03.2011 — CSS:
<i>
</i>position: fixed;
width: 100%;
[/QUOTE]


Already using that in the CSS file.
Copy linkTweet thisAlerts:
@aj_nscJul 03.2011 — @import is pointing to the wrong directory.....so it doesn't look like you are using it in your CSS.

I right clicked the element and clicked "Inspect element" in webkit and checked out all the applied styles, position: fixed wasn't one of them meaning that the styles in nav.css weren't getting applied.

That's why I missed it.

Should be @import(nav.css) - it points relative to the CSS file, not the HTML document that the CSS file is linked to.
Copy linkTweet thisAlerts:
@EpicKrisauthorJul 03.2011 — Missed your @import statement...[/QUOTE]

Thank you so much, I had a slight typo in the ID section.
×

Success!

Help @EpicKris spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...