0

I am trying to create a bootstrap button. What does class"target" do here?

Like

Additionally, I tried searching for it on DevDocs|CSS Documentation as well as MSDN|CSS but couldn't find it anywhere. What's the correct way to look for such class attributes. Isn't this a class attribute?

Ogre Codes
  • 18,693
  • 1
  • 17
  • 24
user6617547
  • 487
  • 1
  • 5
  • 6
  • 1
    Put the code in your question's body, not title. – epascarello Sep 02 '16 at 00:53
  • Bootstrap has no target class that I'm aware of. And is your question "What does class=“target” do in ?", "What's the correct way to look for such class attributes?" or "Isn't this a class attribute?" One question per question please. – j08691 Sep 02 '16 at 00:55
  • Where did you see to use target? – epascarello Sep 02 '16 at 00:55
  • I found it on Free Code Camp. – user6617547 Sep 02 '16 at 00:57
  • To answer your other question, no it's not a class attribute. But `class` is an attribute of `button`. In this case, it's value is `target`. – Jeff Puckett Sep 02 '16 at 01:03
  • And to answer your middle question, http://getbootstrap.com is the official place to see bootstrap class documentation, but as mentioned by others, I don't believe that's a bootstrap class. It is probably a custom class name. – Jeff Puckett Sep 02 '16 at 01:06
  • @JeffPuckettII P, Thanks. It is from a code snippet on Free Code Camp. But Target class has not been declared anywhere there. – user6617547 Sep 02 '16 at 01:22
  • I would like to mention one other thing that might be confusing to a newcomer, and that there exists an `a` attribute called [`target`](http://stackoverflow.com/q/4964130/4233593) which is totally different than this case. – Jeff Puckett Sep 02 '16 at 01:28
  • The Like in your question title is so confusing. I didn't recognize it as part of the code. – CDT Jul 20 '17 at 08:17
  • The page said: "Not every class needs to have corresponding CSS. Sometimes we create classes just for the purpose of selecting these elements more easily using jQuery." Since there is no class specific to bootstrap that is called 'target', i believe they are saying:"lets give all our stuff its own class name to easily select all these elements,,,we'll name it anything we want but for this case we'll name it 'target'". It was confusing how they phrased it in relation to the lessons, but it seems they r just using a normal non-bootstrap class. – kite Aug 14 '20 at 06:40

2 Answers2

2

This is basic HTML 101, it is a CSS class identifier. While Bootstrap defines a bunch of CSS classes, I don't believe "target" is one of them so it's likely whatever example you pulled it from uses it for some other purpose.

The page should have a <style> section or link to a CSS file which defines what elements with the "target" class should appear like. It's also possible it's tagged with the target class for jquery selection.

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
Ogre Codes
  • 18,693
  • 1
  • 17
  • 24
0

Sometimes we create classes just for the purpose of selecting these elements more easily using jQuery or javaScript. I think the class= "Target" was created for that purpose only.

Alien
  • 15,141
  • 6
  • 37
  • 57