0

I am looking to use an ID or Class attribute of a document library in a CSS file. I need to be able to highlight my current tab on my navigational menu.

I can add a CEWP with a text file containing a body ID (to my document library), then referencing that in my CSS file but it doesn't work across different views of the document library as the CEWP disappears when changing views.

Are there any ID attributes that remain the same over the whole document library no matter what view you're in?

Thanks

4
  • I't hard to help with the info you give. Maybe some markup of the different document views would help?
    – Tim
    Jan 29, 2013 at 22:47
  • I ended up just using jQuery for this. Put it in my master page in a script tag. if ( document.location.href.indexOf('<string in URL - I used the name of the document library') > -1 ) { $('UL#topnav A.SecondTab').css('background-image', 'url(highlightedtab.jpg)'); } Used several if statements because each tab has a different class name, e.g. FirstTab, SecondTab etc.
    – Luke
    Jan 30, 2013 at 1:20
  • OK, good you found a solution. Why don't you write that down as an answer to your question an later mark it as the correct answer so other people find it more attractive to read your question if it has a working answer?
    – Tim
    Jan 30, 2013 at 21:00
  • Couldn't reply to my own question within 3 hours or something - I'll try it again. - Posted it but can't accept for 17 hours :/
    – Luke
    Jan 31, 2013 at 3:14

3 Answers 3

0

Maybe the ID is not the best selector for your CSS rule? Why not something containing the title?

0

I ended up just using jQuery for this. Put it in my master page in a script tag.

if ( document.location.href.indexOf('<string in URL - I used the name of the document library') > -1 ) {
        $('UL#topnav A.SecondTab').css('background-image', 'url(highlightedtab.jpg)');
    }

Used several if statements because each tab has a different class name, e.g. FirstTab, SecondTab etc.

0

Try with Below sample Custom CSS Codes apply only Current Library.

#MSOZoneCell_ -- Common for all be placed on First,

WebPartWPQ7 --- Find Out Web part Id using F12 (web developer tools),

.ms-vb2 -- Global Document Library ID's

MSOZoneCell_WebPartWPQ7 .ms-vb2 {

LINE-HEIGHT: 1.2; FONT-FAMILY: Verdana, Helvetica, sans-serif; FONT-SIZE: 70pt;

}

MSOZoneCell_WebPartWPQ7 .ms-itmhover{

display: none;
}

MSOZoneCell_WebPartWPQ7 .ms-vh-icon{

display: none; }

MSOZoneCell_WebPartWPQ7 .ms-vh2{

display: none; }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.