A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.w3resource.com/html-css-exercise/target-attribute-begins-wth-a-certain-value-answer.php below:

Website Navigation


HTML CSS Exercise: Target attribute begins with a certain value

HTML CSS Exercise: Target attribute begins with a certain valueLast update on March 04 2024 06:50:43 (UTC/GMT +8 hours) Solution:

HTML Code:

<!doctype html><!-- Declares the document type and version of HTML -->
<html><!-- Opening tag for the HTML document -->
<head><!-- Opening tag for the head section which contains metadata -->
<title>HTML CSS Exercise - Target attribute begins with a certain value</title><!-- Title of the HTML document -->
<style> /* Opening tag for CSS styling */
.container[data-name^=w3r]{ /* Styles for elements with class 'container' and attribute 'data-name' starting with 'w3r' */
color:#5ac4ed; /* Sets the text color to a shade of blue */
}
</style><!-- Closing tag for CSS styling -->
</head><!-- Closing tag for the head section -->
<body><!-- Opening tag for the body section which contains the content -->
<div class="container" data-name="w3resource">Web developemnt tutorials.</div><!-- Container div with attribute 'data-name' starting with 'w3r' -->
<div class="container" data-name="w3r">HTML, CSS, JS, PHP...</div><!-- Container div with attribute 'data-name' starting with 'w3r' -->
</body><!-- Closing tag for the body section -->
</html><!-- Closing tag for the HTML document -->

Explanation:

Live Demo:

See the Pen target-attribute-begins-wth-a-certain-value-answer by w3resource (@w3resource) on CodePen.

Supported browser

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4