Attribute Selectors

3 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$49.99
List Price:  $69.99
You save:  $20
€42.31
List Price:  €59.24
You save:  €16.92
£36.46
List Price:  £51.05
You save:  £14.58
CA$68.22
List Price:  CA$95.51
You save:  CA$27.29
A$71.20
List Price:  A$99.69
You save:  A$28.48
S$63.56
List Price:  S$88.99
You save:  S$25.43
HK$390.62
List Price:  HK$546.90
You save:  HK$156.28
CHF 38.80
List Price:  CHF 54.32
You save:  CHF 15.52
NOK kr482.40
List Price:  NOK kr675.41
You save:  NOK kr193
DKK kr316.01
List Price:  DKK kr442.44
You save:  DKK kr126.43
NZ$82.98
List Price:  NZ$116.18
You save:  NZ$33.20
د.إ183.58
List Price:  د.إ257.03
You save:  د.إ73.45
৳6,086
List Price:  ৳8,520.90
You save:  ৳2,434.89
₹4,519.08
List Price:  ₹6,327.07
You save:  ₹1,807.99
RM196.56
List Price:  RM275.20
You save:  RM78.64
₦69,022.19
List Price:  ₦96,636.59
You save:  ₦27,614.40
₨13,927.80
List Price:  ₨19,500.03
You save:  ₨5,572.23
฿1,581.60
List Price:  ฿2,214.37
You save:  ฿632.77
₺2,174.83
List Price:  ₺3,044.93
You save:  ₺870.10
B$262.40
List Price:  B$367.39
You save:  B$104.98
R799.44
List Price:  R1,119.28
You save:  R319.84
Лв82.74
List Price:  Лв115.85
You save:  Лв33.10
₩72,773.46
List Price:  ₩101,888.66
You save:  ₩29,115.20
₪154.45
List Price:  ₪216.25
You save:  ₪61.79
₱2,948.71
List Price:  ₱4,128.43
You save:  ₱1,179.72
¥7,830.73
List Price:  ¥10,963.65
You save:  ¥3,132.92
MX$862.86
List Price:  MX$1,208.07
You save:  MX$345.21
QR181.08
List Price:  QR253.52
You save:  QR72.44
P687.86
List Price:  P963.06
You save:  P275.20
KSh6,448.71
List Price:  KSh9,028.71
You save:  KSh2,580
E£2,346.23
List Price:  E£3,284.91
You save:  E£938.68
ብር7,724.74
List Price:  ብር10,815.25
You save:  ብር3,090.51
Kz45,597.53
List Price:  Kz63,840.19
You save:  Kz18,242.66
CLP$42,991.40
List Price:  CLP$60,191.40
You save:  CLP$17,200
CN¥347.04
List Price:  CN¥485.88
You save:  CN¥138.84
RD$3,136.63
List Price:  RD$4,391.53
You save:  RD$1,254.90
DA6,492.08
List Price:  DA9,089.44
You save:  DA2,597.35
FJ$109.96
List Price:  FJ$153.96
You save:  FJ$43.99
Q381.96
List Price:  Q534.78
You save:  Q152.81
GY$10,418.46
List Price:  GY$14,586.67
You save:  GY$4,168.21
ISK kr6,135.27
List Price:  ISK kr8,589.87
You save:  ISK kr2,454.60
DH456.80
List Price:  DH639.55
You save:  DH182.75
L843.34
List Price:  L1,180.74
You save:  L337.40
ден2,607.44
List Price:  ден3,650.62
You save:  ден1,043.18
MOP$400.75
List Price:  MOP$561.08
You save:  MOP$160.33
N$797.64
List Price:  N$1,116.76
You save:  N$319.12
C$1,832.78
List Price:  C$2,566.04
You save:  C$733.25
रु7,199.05
List Price:  रु10,079.25
You save:  रु2,880.19
S/167.64
List Price:  S/234.72
You save:  S/67.07
K213.35
List Price:  K298.72
You save:  K85.36
SAR187.46
List Price:  SAR262.46
You save:  SAR75
ZK977.31
List Price:  ZK1,368.31
You save:  ZK391
L215.54
List Price:  L301.77
You save:  L86.23
Kč1,030.54
List Price:  Kč1,442.83
You save:  Kč412.29
Ft16,121.11
List Price:  Ft22,570.84
You save:  Ft6,449.73
SEK kr447.54
List Price:  SEK kr626.59
You save:  SEK kr179.05
ARS$72,235.55
List Price:  ARS$101,135.55
You save:  ARS$28,900
Bs344.11
List Price:  Bs481.78
You save:  Bs137.67
COP$180,987.21
List Price:  COP$253,396.58
You save:  COP$72,409.36
₡24,732.84
List Price:  ₡34,627.96
You save:  ₡9,895.11
L1,315.73
List Price:  L1,842.13
You save:  L526.39
₲330,393.52
List Price:  ₲462,577.37
You save:  ₲132,183.84
$U1,926.34
List Price:  $U2,697.03
You save:  $U770.69
zł178.72
List Price:  zł250.22
You save:  zł71.50
Already have an account? Log In

Transcript

Hello, in this CSS Crash Course video, we're going to be looking at attribute selectors. So what is an attribute selector? Well, in your CSS, we selected elements using stuff like Dave, you've done it using stuff like hash something which would refer to a deer with a certain unique ID or dot, which refers to a particular class. And you'll put the name afterwards, what you can do is target a particular element that has a certain attribute. Let me demonstrate that if I go to my index for zoom in, and I'm going to put a few elements here, I'm gonna put input. I'm gonna put type of text and I'm also going to put another input, which is going to be a type of submit basically button for a div and this div is simply going to have an attribute called some thing.

This is an attribute. This is also an attribute and this attribute is assigned text and submit. It does not have to be assigned something inside here, hello. Another div not going to have any attribute class or ID. We'll save that. Go to the website refresh.

This is what we get. We go to index dot CSS for now. What we can actually do is select it using the attribute selectors. So let me zoom in. And we're going to put input the square brackets type equals text. Now fee, I think you can guess what this does.

It target every input that you Have type text of the Submit will not be affected by proper background color as red, save that, go back refresh. As you can see, this is red, but this isn't. So if we have multiple text items, instead of adding classes, if you know your small all your text inputs to be read, or you want them to be of a certain size or have this particular CSS property, then you can just do it like this. And now, let me just show you how to do it. If the actual attribute doesn't have something assigned to it, it's very simple. You put the element name, then you put a square bracket, you simply put the attribute that is it in here, but font size equals three em, save that go back refresh.

As you can see, this has changed size but this hasn't. So that's it. This is just been a quick video on it. attribute selectors in CSS. If you have any questions, feel free to post them on my education platform, sonar learning.co.uk or contact us messages by platform, contact us via Twitter however you feel comfortable. Plus there will be a resource link to all of the fourth code from this video and every other video in this series.

And as usual, thank you for watching and I hope you have a great day.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.