Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > position page fragment (anchor) on top of page.

Reply
Thread Tools

position page fragment (anchor) on top of page.

 
 
Erwin Moller
Guest
Posts: n/a
 
      07-27-2012

I have a page with multiple repeating divs that display history-entries
for some thing I am developing.
Each div contains an "edit" and "delete" icon.
When edit is clicked, the page reloads with the clicked item open for edit.
It will be positions on top of the page via an anchor
(mypage.php?histid=2345#edit).
That is all fine. The user clicks the item, and it appears on top of the
page in editmode (with a form), and all others are just displayed in
display/view mode (no form).

However, I also have a "new entry" link, that opens a form at the bottom
of the page (mypage.php#new).
To get this also on top of the page, I add a bunch of <br> under that
form, otherwise the form will be low on the screen, since it is the last
thing displayed on the document.

My question: I somehow dislike these stupid <br> at the end of my
document. For myself, if I look at a page, I often scroll down to see
what is there, but in this case it is only empty space.
So all those <br> feel somehow like a stupid solution.

I wonder if anybody has any suggestions for a cleaner solution.

Note: I try to develop in such a way that my visitors don't need
Javascript to use the webpage.

Regards,
Erwin Moller

--
"That which can be asserted without evidence, can be dismissed without
evidence."
-- Christopher Hitchens
 
Reply With Quote
 
 
 
 
dorayme
Guest
Posts: n/a
 
      07-27-2012
In article <50125000$0$6871$(E-Mail Removed)4all.nl>,
Erwin Moller <(E-Mail Removed)> wrote:

> I have a page with multiple repeating divs that display history-entries
> for some thing I am developing.
> Each div contains an "edit" and "delete" icon.
> When edit is clicked, the page reloads with the clicked item open for edit.
> It will be positions on top of the page via an anchor
> (mypage.php?histid=2345#edit).
> That is all fine. The user clicks the item, and it appears on top of the
> page in editmode (with a form), and all others are just displayed in
> display/view mode (no form).
>
> However, I also have a "new entry" link, that opens a form at the bottom
> of the page (mypage.php#new).
> To get this also on top of the page, I add a bunch of <br> under that
> form, otherwise the form will be low on the screen, since it is the last
> thing displayed on the document.
>
> My question: I somehow dislike these stupid <br> at the end of my
> document. For myself, if I look at a page, I often scroll down to see
> what is there, but in this case it is only empty space.
> So all those <br> feel somehow like a stupid solution.
>
> I wonder if anybody has any suggestions for a cleaner solution.
>
> Note: I try to develop in such a way that my visitors don't need
> Javascript to use the webpage.
>



Yes, <br>s are a little inelegant. I guess not much better is an empty
last DIV styled to have a height at least to the number of BRs you
were using.

Another way would be to have the form off the page and linked to a
separate page, that would mean a different design (something I would
have no hesitation in doing and keeping pages short and
single-purposed).

If you are really wanting it to be on the same page, perhaps something
like the following, maybe you can play with the percentage assigned to
the last DIV to suit your purpose if you don't think it as inelegant
as the BRs (the width to body is merely to exacerbate the height for
the demo, you would not need it. I also use Ps instead, not important
though:

html, body {height: 100%;}
body {width: 8em;}
#lastItem {height: 100%;}

<body>
<p>
<a href="#lastItem">Last Item link</a> Cras vel eros. Vivamus
sed odio et orci tincidunt ornare. Duis dui lectus, commodo ut,
gravida id, ultricies quis, tellus. Vestibulum blandit nibh eget
turpis. Quisque mollis, lacus consectetur eleifend convallis, diam
augue blandit magna. And more of the same...
</p>
<p>
Cras vel eros. Vivamus sed odio et orci tincidunt ornare. Duis
dui lectus, commodo ut, gravida id, ultricies quis, tellus. Vestibulum
blandit nibh eget turpis. Quisque mollis, lacus consectetur eleifend
convallis, diam augue blandit magna. And more of the same...
</p>
<p>
Cras vel eros. Vivamus sed odio et orci tincidunt ornare. Duis
dui lectus, commodo ut, gravida id, ultricies quis, tellus. Vestibulum
blandit nibh eget turpis. Quisque mollis, lacus consectetur eleifend
convallis, diam augue blandit magna. And more of the same...
</p>
<p id="lastItem">
<b>Last item</b> Cras vel eros. Vivamus sed odio et orci
tincidunt ornare. Duis dui lectus, commodo ut, gravida id, ultricies
quis, tellus. Vestibulum blandit nibh eget turpis. Quisque mollis,
lacus consectetur eleifend convallis, diam augue blandit magna. And
more of the same...
</p>
</body>

--
dorayme
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to cache part of a page without using fragment caching sam ASP .Net 1 03-07-2006 06:01 PM
Globally turn page fragment caching off? DC ASP .Net 3 10-18-2005 02:51 PM
Printing a fragment from a web page Nicolae Fieraru HTML 8 06-04-2005 10:50 AM
Fragment Caching inside page caching? Troy Simpson ASP .Net 0 01-19-2004 11:57 AM
fragment page caching quique ASP .Net 0 10-30-2003 11:17 AM



Advertisments