Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Give CSS to a tag less text present in a div.

  • This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #36705
    yasser1688
    Member

    This is how my table code is shown when I view it using Firefox firebug.
    I am using Razor with MVC and I am doing paging and these are links to pages.

    What I want to know is there any way I can give some css to add a special/seperate style to the number 7 (Note number 7 here is the current selected page and hence no link is shown)

    OR is there any way I can add tag to this text using Javascript/jquery ?

    Please any help is appreciated.

    This is my first post here, so I am really sorry if I have not followed any rules/conventions for writing a post.

    Thanks in advance
    Yasser

    #96877
    Zeriz
    Member

    Not sure if I understand the question 100%, but from what I can see you know what a class and a id is – but it always helps to refresh your mind about the basics.

    An ID can only be used once in a document, and a class selector can be used as many times you’d wish to. And if you give that number seven a unique ID you will be able to style it like you want.


    7



    #96878
    yasser1688
    Member

    Hi Zeriz,

    Yes I know, but the thing is this html code is generated by the MVC Razor engine and not by me, I am just trying to implemented css here,

    Is there any way I can do this ?

    OR any way in which I can add an HTML tag to this text dynamically using jquery or javascript

    #96880
    Zeriz
    Member

    I’m sorry, I have less experience with the MCV Razor engine, so I’m not sure if I can help any further now that I see what the real problem is. I guess you could make jQuery search the documents for the id “#footer”, and make it go to the 7th a-attribute to give it an unique ID – but that sounds like a very clumsy way to do this.

    I think you should look for the code part that processes this HTML to the document and see if there is any possibility to give it an unique ID from there. :)

    #96897
    monk18
    Member

    You can use jQuery. In jQuery you ‘ll have the ability to select a specific child. These links should help you.

    http://www.mkyong.com/jquery/jquery-nth-child-selector-example/
    https://css-tricks.com/how-nth-child-works/
    https://css-tricks.com/useful-nth-child-recipies/

    #96989
    yasser1688
    Member

    HI Monk18,

    Thanks for your reply. I have seen the links you posted. But in my case the child will keep on changing.. is there any way to check which child is not surrounded by any tag and then surround it by some tag ?

    #96998
    yasser1688
    Member

    Yes, I did try that and I was some what successfull too but now only thing is that the spacing problem still persists.

    Here is the screenshot : Link to screenshot…

    I know I am close to it, please one more hint and I am there

    Thanks in advance :)

    #97014
    yasser1688
    Member

    Worked like a charm !!!!

    I love this forum

    Thanks senff. Made my day!

    #120059
    arun7331
    Participant

    Also you can check this link for a pure css dropdown menu. I don’t see any client script written in there and it looks good. But there is a problem. It performs differently in a firefox browser.

    http://www.encodedna.com/2013/01/css-animated-dropdown-menu.htm

Viewing 9 posts - 1 through 9 (of 9 total)
  • The forum ‘CSS’ is closed to new topics and replies.