Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAnnika Song
2,033 Pointshow can i change the border style to solid and how can i change the border color to red?
thankyou
<!doctype html>
<html>
<head>
<link href="styles.css" rel="stylesheet">
</head>
<body>
<p class="main-pg">My amazing website</p>
</body>
</html>
.main-pg{
border-width=4px;
border-style=
border-color=
}
2 Answers
Matthew Lawson
7,283 PointsJon Myzzle Absolutely! Learning the 'short-hand' I guess you could call it definitely simplifies things especially when you're working on bigger projects.
Jon Myzzle
6,279 PointsHello Annika,
There's a few ways you can do this but I find the easiest way, and simplest to remember is the following:
.main-pg {
border: 4px solid red;
}
This code translates to exactly what you read. "I want my main-pg class to have a border that is 4px, its solid, and the color is red".
A great tool for referencing syntax in code is definitely the MDN website that Treehouse references quite a bit. If you find yourself stuck and cant remember the property, or even the correct format for the values, this site can help QUITE a bit!
I hope this helps!!
Cheers, and happy coding!
-Jon
Matthew Lawson
7,283 PointsJon Myzzle - an even better way of doing it! ?
Jon Myzzle
6,279 PointsIndeed! It helps to keep the code consolidated and much much easier to read. Plus its easier to remember 1 line of properties /values versus remembering the 3 of them!
Matthew Lawson
7,283 PointsMatthew Lawson
7,283 PointsMake sure you use the colon after your CSS properties :)
Also if you're ever struggling with what certain properties you can use for various selectors you can always check the MDN or W3Schools.
https://developer.mozilla.org/en-US/docs/Learn/CSS/Styling_boxes/Borders
https://www.w3schools.com/cssref/default.asp
Hope this helps