Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS CSS Basics (2014) Enhancing the Design With CSS Text Shadows and Box Shadows

text-shadow

not sure im getting how to set the color on this one?

style.css
/* Complete the challenge by writing CSS below */
.main-heading {
  text-shadow: 0, 0, 5px, rgba( #be7b31);
}
index.html
<!DOCTYPE html>
<html>
  <head>
    <title>Lake Tahoe</title>
    <link rel="stylesheet" href="page.css">
    <link rel="stylesheet" href="style.css">
  </head>
  <body> 
    <header id="top" class="main-header">
      <span class="title">Journey Through the Sierra Nevada Mountains</span>
      <h1 class="main-heading">Lake Tahoe, California</h1>
    </header>

        <div class="primary-content">
            <p class="intro">
                Lake Tahoe is one of the most breathtaking attractions located in California. It's home to a number of ski resorts, summer outdoor recreation, and tourist attractions. Snow and skiing are a significant part of the area's reputation.
            </p>
            <a class="callout" href="#more">Find out more</a>
        </div><!-- End .primary-content -->

        <footer class="main-footer">
            <p>All rights reserved to the state of <a href="#">California</a>.</p>
            <a href="#top">Back to top &raquo;</a>
        </footer>
  </body>
</html>

2 Answers

As Shehan said, to declare a color, you either use keywords such as "red" or "slategrey"; hex numbers such as "#ffffff" or "#4e9f00": or rgb/rgba functions such as "rgb(0, 0, 0,)" or "rgba(255, 152, 24, 0.5)" (The fourth parameter on the rgba function controls transparity).

What you're doing is wrong because rgba() accepts three integer parameters and one floating point and you're giving it a hexadecimal value which makes no sense. Replace "rgba( #be7b31)" with "#be7b31".

Additionally, there should not be commas separating the parameters "of text-shadow:" If you do all of this your css should look like this:

.main-heading {
  text-shadow: 0 0 5px #be7b31;
}

Keep in mind, however, that using a hexadecimal will produce an opaque color and judging by your attempt to use "rgba" I assume that you want a somewhat transparent one. By searching "color picker" on google and entering "#be7b31" you can find the corresponding rgb function. I did this and found it to be: "rgb(190, 123, 49)"! now to add transparency, you can change the "rgb" function to an "rgba" function and add a fourth parameter: rgba(190, 123, 49, 0.5) where 0 is completely transparent and 1 is completely opaque. Here is the final fixed code:

.main-heading {
  text-shadow: 0 0 5px rgba(190, 123, 49, 0.5);
}

Hope that helps!

Shehan Dissanayake
Shehan Dissanayake
19,119 Points

Hello Clayton, We don't declare hex values inside a rgba value. So in your code rgba( #be7b31)

part is wrong.

rgba stands for

  • r = red
  • g = green
  • b =blue
  • a =alpha (Transtparency)

Below are some examples

  • rgb(255, 255, 255); = This is white color (#fff)
  • rgb(0,0,0,) = This is black (#000)

when you add 'a' you can make the color transparent so for an example;

  • rgba(0,0,0,0.5) - Half Transparent Black.

I created a fiddle for you to understand this visually, you can find it here

Here is a good article about rgba colors You can find a good example article about rgba colors here

Thanks