From the course: Design the Web: Creating a Sortable Table
Unlock this course with a free trial
Join today to access over 22,600 courses taught by industry experts.
Creating CSS triangles to indicate sort order
From the course: Design the Web: Creating a Sortable Table
Creating CSS triangles to indicate sort order
- [Voiceover] Now that we're highlighting the table cell that represents the column that the table's being sorted against, now what we're going to do is create some arrows with CSS to indicate the direction of the sort, whether the sort is in an ascending or descending order. Now we already have the classes being injected, so let's go back to our CSS file and add in some additional rules. And now to add the object for the triangle, I don't want to go back to the HTML and add in some additional HTML markup. So we're going to use the CSS pseudo element to inject an object and then create our triangles using some border properties. So in our CSS file, let's hit a few Returns. I want to create these new rules or pseudo element into the th.sorted after this rule here. So let's come up here and copy this entire rule. After this, let's paste this again. Now what we want to do is add this pseudo element to the th.sorted, so we'll type two colons, then the word after, then a space, then put in…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
Preparing the HTML file3m 13s
-
(Locked)
Activating the plugin6m 2s
-
(Locked)
Setting a default sort on page load3m 24s
-
(Locked)
Highlighting the sorted column4m 54s
-
(Locked)
Creating CSS triangles to indicate sort order4m 34s
-
(Locked)
Creating custom sort properties8m 16s
-
(Locked)
Where to go from here55s
-