www.webdeveloper.com
Results 1 to 9 of 9

Thread: Target link as CSS link?

Hybrid View

  1. #1
    Join Date
    Sep 2005
    Posts
    1,635

    Question Target link as CSS link?

    I have the following code for my target:
    <li><a href="#scrollTotarget1">Target1</a></li>

    How to make CSS in the correct way as this is not recognized as link inside browser.

    CSS code is like:
    PHP Code:

    nav
    .topmanus1 ul li {
     
    color#000000;
     
    background#CC0000;


  2. #2
    Join Date
    Mar 2012
    Posts
    1,752
    For this to work, there has to be an ID (or name) 'scrollTotarget1' in the web page. E.g.

    <div id="scrollTotarget1">

  3. #3
    Join Date
    Sep 2005
    Posts
    1,635
    You mean the following:
    HTML Code:
    <div id="scrollTotarget1"> 
    <ul>
    <li><a href="#scrollTotarget1">Target1</a></li>
    </ul>
    </div>

  4. #4
    Join Date
    Mar 2012
    Posts
    1,752
    Yes. Assuming there is sufficient content bellow the target to fill the window, clicking on the anchor will cause it to scroll to the top of the window.

  5. #5
    Join Date
    Mar 2014
    Posts
    40
    Try that :

    nav.topmanus1 ul li a {
    color: #000000;
    background: #CC0000;
    }

  6. #6
    Join Date
    Mar 2012
    Posts
    1,752
    Quote Originally Posted by Samphywii View Post
    Try that :

    nav.topmanus1 ul li a {
    color: #000000;
    background: #CC0000;
    }
    What were you seeking to achieve by this?

  7. #7
    : better to use target="_blank"
    <a href="#scrollTotarget1" target="_blank">Target1</a>
    By using target="_blank" it will open in the same page.

  8. #8
    Join Date
    Mar 2012
    Posts
    1,752
    Quote Originally Posted by robertsullivan View Post
    : better to use target="_blank"
    <a href="#scrollTotarget1" target="_blank">Target1</a>
    By using target="_blank" it will open in the same page.
    No it won't!!! Target="_self", target="_parent" and target="#" open in the same page. Target="_blank" opens a new tab or window. Also it less used nowadays because it requires devices to be able to multi-task. Smart-phones are often single-tasking devices, so cannot open multiple tabs/pages at the same time.

  9. #9
    Join Date
    Nov 2013
    Location
    new york
    Posts
    68
    I agree with the first response, we need to mention it in id format. then it will support.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles