Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to incorporate link CSS with an ID CSS?

Enthusiast ,
Jan 25, 2018 Jan 25, 2018

I have a table set up and have the BG color and so forth ready but cannot figure out how to make a text link inside of the table have stylized link effects in it. Here is what I have. I thought that because I included the link styling in the #mm part it would work. Any help is appreciated thank you.

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>Untitled Document</title>

<style>

#mm {

    color: #ffffff;

background-color: #1f4d81;

a:link {

    color: #ffffff;

text-decoration: none;

}

a:visited {

    color: #ffffff;

text-decoration: none;

}

a:hover {

    color: #ffffff;

text-decoration: underline;

}

a:active {

    color: #ffffff;

text-decoration: underline;

}

</style>

</head>

<body>

<br/>

<table width="100%" id="mm" border="0" cellspacing="20" cellpadding="20">

   <tbody>

      <tr>

         <td width="4%" align="center" valign="middle">

            <img width="76" height="69" src="mm-logo.png" alt=""/>

         </td>

  <td width="96%" align="left" valign="middle">Some white text here

            <a href="page.html" target="_blank" style="text-decoration: underline;">Click here to join the conversation</a></td>

      </tr>

   </tbody>

</table>

</body>

</html>

441
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 25, 2018 Jan 25, 2018

You're missing an ending } for your #mm id.

#mm is the <div>

a:whatever is written after (overwrites) and specifically targets the links.

"#mm a:whatever" as a selector will probably get you where you want to be. (affecting only the links inside the <div id="mm">)

Remove the inline css from the link, inline will (almost) always overwrite the external sheet or <head> css.

If you want all the text to be white, and have an underline show up on :hover or while being clicked with :active (I think what you

...
Translate
Community Expert ,
Jan 25, 2018 Jan 25, 2018

You're missing an ending } for your #mm id.

#mm is the <div>

a:whatever is written after (overwrites) and specifically targets the links.

"#mm a:whatever" as a selector will probably get you where you want to be. (affecting only the links inside the <div id="mm">)

Remove the inline css from the link, inline will (almost) always overwrite the external sheet or <head> css.

If you want all the text to be white, and have an underline show up on :hover or while being clicked with :active (I think what you're going for?), this is how I would change your code...

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>Untitled Document</title>

<style>

#mm {

    color: #ffffff;

    background-color: #1f4d81;

}

#mm a {

    color: #ffffff;

    text-decoration: none;

}

#mm a:visited {

    text-decoration: none;

}

#mm a:hover {

    text-decoration: underline;

}

#mm a:active {

    text-decoration: underline;

}

</style>

</head>

<body>

  <br/>

  <table width="100%" id="mm" border="0" cellspacing="20" cellpadding="20">

    <tbody>

      <tr>

        <td width="4%" align="center" valign="middle"><img width="76" height="69" src="mm-logo.png" alt=""/></td>

        <td width="96%" align="left" valign="middle">Some white text here <a href="page.html">Click here to join the conversation</a></td>

      </tr>

    </tbody>

  </table>

</body>

</html>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jan 25, 2018 Jan 25, 2018
LATEST

Really appreciate it thanks so much!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines