Hello I need to have three icons on my page.
1:mail icon 2:pdf icon 3: print icon.
I have written the following HTML for three icons. Remember I want these three icons to remain fixed and should not move with the page scroll.
I have created a div tag to hold these icons. This div rests inside a top level div element which holds the rest of the page(Main content, which can be printed).
#topMenu {
height: 22px;
overflow: visible;
padding: 23px 20px 0 0;
width: 695px;
}
#topmenu ul {
float: right;
}
#topmenu ul li {
float: left;
margin-left: 8px;
text-indent: -9999px;
}
#topmenu ul li a {
background: url("images/icon_pdf.jpg") no-repeat top left;
display: block;
height: 20px;
width: 20px;
}
#topmenu ul li a[title="email"] {
background: url("images/icon_mail.jpg") no-repeat top left;
}
#topmenu ul li a[title="print"] {
background: url("images/icon_print.jpg") no-repeat top left;
}
First I need to sort out how to display these icons and second I want this div tag to remain static so that icons dont move as the page scrolls as it is a one web page.
When I run this page , I dont find my icons anywhere on the page.Do you have any Idea as to where I am doing wrong here.
Thanks
Edit: In FF I am seeing three dots(I guess because of li) but Chrome doesn't display anything.
Last edited by refhat; 07-20-2010 at 08:21 AM.
Reason: More Information
Regarding your images showing up, are the images in the images directory and is the path correct? Continuing, regarding the bullets showing up, add the following to this existing rule:
Code:
#topmenu ul li {
float: left;
margin-left: 8px;
text-indent: -9999px;
list-style-type:none;
}
For the elements not scrolling with the page, you'll have to set your div that contains your content to:
Regarding your images showing up, are the images in the images directory and is the path correct? Continuing, regarding the bullets showing up, add the following to this existing rule:
Code:
#topmenu ul li {
float: left;
margin-left: 8px;
text-indent: -9999px;
list-style-type:none;
}
For the elements not scrolling with the page, you'll have to set your div that contains your content to:
Code:
#mycontent{
position:fixed;
}
Thanks for the reply.
Offcourse the icons are in the images folder, I have tried putting them in a parent directory(where my page exists) and changed the relative path. still it doesn't work.
Regarding bullets showing up, I am not worried about that as they dont appear in chrome. They just appear in FF and the text doesn't.
I would classes (or IDs) rather than advanced selectors (a[title="email"]) since that is not the most reliable across browsers.
Code:
<li>
<a class="email"> </a>
</li>
#topmenu ul li a.email {
//set background image here
}
Semantically it would make more sense to me for the img to be within the a tags and make use of the alt attribute as that would handle odd cases like text readers and such plus you wouldn't have to mess with negative indentions (which doesn't always work the same across rendering engines).
Thanks Dude, I finally got over it. Also can I have a div fixed, i-e it should not scroll with the page. Actually My icons are in top level div, These icons will print the contents of the page that are in the second div(main central). I want the top div that holds the icons to remain static so that I can use icons to do their task, because my central div is scoll page.
Bookmarks