Questions tagged [label]

A label is a placeholder for text and other UI elements.

Label is a commonly used term for a user interface element. It is applicable to both web, and windows environment. It is typically an element with limited functionality, used solely, or at least primarily, for display purposes.
It can also have additional roles such as providing hooks for accessibility and assistive technologies. The HTML label tag is often used for this purpose.

Definition and Usage

  • The <label> tag defines a label for an element.
  • The <label> element does not render as anything special for the user. However, it provides a usability improvement for mouse users, because if the user clicks on the text within the <label> element, it toggles the control.
  • The for attribute of the <label> tag should be equal to the id attribute of the related element to bind them together.
  • The for attribute specifies which form element a label is bound to.
11279 questions
1180
votes
12 answers

How to create a checkbox with a clickable label?

How can I create an HTML checkbox with a label that is clickable (this means that clicking on the label turns the checkbox on/off)?
laurent
  • 88,262
  • 77
  • 290
  • 428
883
votes
9 answers

Rotating and spacing axis labels in ggplot2

I have a plot where the x-axis is a factor whose labels are long. While probably not an ideal visualization, for now I'd like to simply rotate these labels to be vertical. I've figured this part out with the code below, but as you can see, the…
Christopher DuBois
  • 42,350
  • 23
  • 71
  • 93
453
votes
7 answers

What does "for" attribute do in an HTML

I wonder what is the difference between the following two code snippets: and
jeff
  • 13,055
  • 29
  • 78
  • 136
415
votes
6 answers

React ignores 'for' attribute of the label element

In React (Facebook's framework), I need to render a label element bound to a text input using the standard for attribute. e.g. the following JSX is used: However, this produces HTML…
goofballLogic
  • 37,883
  • 8
  • 44
  • 62
294
votes
10 answers

How can I wrap text in a label using WPF?

I have a TextBox and a Label. After clicking a button, I execute the following code: label1.Content = textbox1.Text; My question is, how do I enable text wrapping of the label? There may be too much text to display on one line, and I want it to…
jeremychan
  • 4,309
  • 10
  • 42
  • 56
282
votes
9 answers

How to set common axes labels for subplots

I have the following plot: import matplotlib.pyplot as plt fig2 = plt.figure() ax3 = fig2.add_subplot(2,1,1) ax4 = fig2.add_subplot(2,1,2) ax4.loglog(x1, y1) ax3.loglog(x2, y2) ax3.set_ylabel('hello') I want to be able to create axes labels and…
farqwag25
  • 2,821
  • 3
  • 15
  • 3
274
votes
8 answers

How to set different label for launcher rather than activity title?

This question has been asked before - but with no satisfying answer at all! So I'm trying it again. I want to give my application launcher icon (the one that is displayed on the startscreen!) a different, shorter caption. It seems the launcher takes…
Zordid
  • 10,451
  • 11
  • 42
  • 58
211
votes
20 answers

Word wrap for a label in Windows Forms

How can one get word wrap functionality for a Label for text which goes out of bounds?
Nagu
  • 4,954
  • 14
  • 52
  • 67
209
votes
10 answers

How to change the text of a label?

I have a radiobutton list and on click on the radio button item I have to change the text of its label. But for some reason it's not working. Code is below:
Amit
  • 6,839
  • 21
  • 56
  • 90
193
votes
11 answers

Label Alignment in iOS 6 - UITextAlignment deprecated

Seems like UITextAlignmentCenter is deprecated in iOS 6. I still use it and works well, but it gives a warning. How can I fix this? label.textAlignment = UITextAlignmentCenter; Thanks.
user123
  • 2,711
  • 5
  • 21
  • 25
186
votes
2 answers

Editing legend (text) labels in ggplot

I have spent hours looking in the documentation and on StackOverflow, but no solution seems to solve my problem. When using ggplot I can't get the right text in the legend, even though it's in my dataframe. I have tried scale_colour_manual,…
user3633161
  • 1,963
  • 2
  • 12
  • 6
182
votes
35 answers

Label under image in UIButton

I'm trying to create a button which has some text beneath the icon (sorta like the app buttons) however it seems to be quite difficult to achieve. Any ideas how can I go about get the text to display below the image with a UIButton?
NRaf
  • 7,407
  • 13
  • 52
  • 91
177
votes
5 answers

Rotating axis labels in R

How do I make a (bar) plot's y axis labels parallel to the X axis instead of parallel to the Y axis?
Phoebe
  • 2,774
  • 3
  • 22
  • 27
164
votes
5 answers

Difference between Label and TextBlock

According to the Windows Applications Development with Microsoft .NET 4 70-511 Training Kit What is the difference between the Label control and TextBlock control since both are content controls and just displaying text?
Rami Alshareef
  • 7,015
  • 12
  • 47
  • 75
161
votes
9 answers

How can I control the width of a label tag?

The label tag doesn't have the property 'width', so how should I control the width of a label tag?
tirenweb
  • 30,963
  • 73
  • 183
  • 303
1
2 3
99 100