HTML CSS Exercise: Select elements by attribute
Solution:
HTML Code:
<!doctype html>
<html>
<head>
<title>HTML CSS Exercise - Select elements by attribute</title>
<style>
.container[data-name=w3r]{
color:#5ac4ed;
}
</style>
</head>
<body>
<div class="container" data-name="w3r">Web developemnt tutorials.</div>
<div class="container">HTML, CSS, JS, PHP...</div>
</body>
</html>
Live Demo:
See the Pen select-elements-by-attribute-answer by w3resource (@w3resource) on CodePen.
Supported browser
![]() |
![]() |
![]() |
![]() |
![]() |
Yes | Yes | Yes | Yes | Yes |
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends
- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join