Re: hover

Discussion in 'HTML' started by Jukka K. Korpela, Mar 6, 2010.

  1. philmagic wrote:

    > I want to declare style for my hypertext links.
    > This particuliar style says : Don't change anything in the style of
    > link, just underline when mouse is over.
    > I know hos to do : "under line when mouse is over".$= by "a:hover"


    If you really knew how to do that, you would have told us the URL showing
    how you do that and what the context is. Using a:hover is questionable. Even
    if your page does not contain <a> elements that aren't links and you don't
    intend to add them, you're taking an unnecessary risk.

    Besides, most browsers display links as underlined by default, so it would
    mostly be a dummy operation.

    > But how to do if i don't want change anything to the style declared
    > for the link (same color than before after, sdame font, same size) ?


    You just do it.

    > I want the text must be underlined when mouse passes over.


    There's no "must" in CSS effects in reality. Check the CSS Caveats:
    http://www.cs.tut.fi/~jkorpela/css-caveats.html

    > If I don't declare anything on the style of hypertext link, on
    > hyperlink are blue.


    Probably... didn't you say that was what you wanted?

    > Impossible to let the original color of text...


    Is _that_ what you really want? It's completely different from what you
    wrote before.

    If you mean that you will remove all default formatting of links by browser
    stylesheets, i.e. make them look like normal text, excep that they are
    underlined on mouseover, then you would in principle need to set all CSS
    properties for links and set them the same as for normal text (whatever that
    really means). In practice, setting color (and background) and underlining
    is probably sufficient, e.g.

    body, :link, :visited {
    color: black !important;
    background: white !important; }
    :link, :visited {
    text-decoration: none !important; }
    :link:hover, :visited:hover {
    text-decoration: underline !important; }

    > All that for a special purpose that it's too long to explain here.


    Bad for you. The odds are that your _real_ problem is a misunderstading of
    the situation where you are, and we cannot help with that if you don't
    describe it. (If it were a rare case where the idea makes sense, it would
    probably be easy to explain, like "I'll do this as part of a game.")

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Mar 6, 2010
    #1
    1. Advertising

  2. philmagic wrote:

    ><div align="justify"
    > class="texte_publicitaire00036">En apparence, rien n'encombre le frac
    > noir et les dentelles blanches qui la pomponnent. Pourtant, de sa
    > canne s'étire un grand foulard de soie. Un bouquet de fleurs émerge
    > de ses gants. De dessous une écharpe, une première colombe frémit, et
    > bat des ailes... Six apparaîtront ainsi successivement durant ce


    As an aside, unhyphenated text can look really awful when in a narrow
    column, especially with justification. Long words like "successivement" may
    cause large gaps between words in preceding lines. If you cannot make the
    column wider, I'd suggest you apply some method of hyphenation, e.g. the
    automatic client-side hyphenation that you can generate as described at
    http://code.google.com/p/hyphenator/

    > I use html because it is a good page description language.


    HTML isn't a page description language at all. It's just a poor lonesame
    data format. Using CSS on an HTML document, you can do some simple (and
    often good enough) formatting, but even in CSS, you cannot even control
    paging reasonably - current implementations basically support just forced
    page breaks, not automatic paging in a controllable way.

    > I thought it was very elegant that the user can click (for example on
    > the subtitle) for changing color or font or style of the subtitle.
    > For that, I would that the subtitle be an hypertext link towards a
    > part of my program which treats the changing of style of the
    > subtitle. But in this case, the subtitle which is orange appears blue
    > and underlined.


    You don't need links at all. You can simply assign :hover styles to various
    elements (I hope you can ignore ancient browsers that support :hover on
    links only), and you can assign onclick="..." attributes (or use JavaScript
    to assign event handlers to elements) to any element.

    There would be no default styling for links to be overridden, but :hover
    could be used to indicate what the element "under inspection" is, e.g. with

    div { outline: dotted 2px #333; }

    (The reason for using outline and not border is that outline appears outside
    the element's area, over whatever content happens to be there, without
    changing the layout the way that addition of borders does.)

    In some other contexts, it might be useful to "back up" JavaScript
    processing using links, so that
    <a href="foo.html" onclick="do_something(); return false">foobar</a>
    works without JavaScript too, in the sense of creating a clickable link to
    foo.html. But in your case, this would be pointless. It would also be
    pointless to make elements links just because some very old browsers
    supported onclick="..." on links only.

    You could even use <a class="..." onclick="...">...</a>, which is not a link
    (there is no href attribute), just an <a> element, which is in such cases
    effectively just a shorter form of <span> - i.e., text level markup with no
    semantics and no default styling.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Mar 7, 2010
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. msnews.microsoft.com
    Replies:
    0
    Views:
    2,321
    msnews.microsoft.com
    Jun 26, 2003
  2. Paul

    Toolbar appears on image hover

    Paul, Jul 16, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    376
  3. Brad

    Hover button

    Brad, Jan 25, 2004, in forum: ASP .Net
    Replies:
    6
    Views:
    2,382
    Scott M.
    Jan 25, 2004
  4. alanb
    Replies:
    2
    Views:
    539
    alanb
    Apr 23, 2004
  5. VB Programmer

    Change cell color when hover

    VB Programmer, Jun 11, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    3,822
    VB Programmer
    Jun 11, 2004
Loading...

Share This Page