Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why I can't change font size for label?

Tags:

I have little problem and don't know why it doesn't work. I tried to change font size for label tag, but I can't set less than 10px. Why?

.group {
  margin-bottom: 20px;
}
.group label {
  font-size: 10px;
}
.group2 label {
  font-size: 8px;
}
<div class="group">
  <label for="input1">First label</label>
  <input type="text" name="input1">
</div>
<div class="group group2">
  <label for="input2">Second label</label>
  <input type="text" name="input2">
</div>
like image 888
Jakub Avatar asked Feb 27 '17 12:02

Jakub


People also ask

How do I change font size in labels?

To change the font size in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML <p> tag, with the CSS property font-size. HTML5 do not support the <font> tag, so the CSS style is used to add font size.

How do you change the font size on a label in HTML?

In HTML, you can change the size of text with the <font> tag using the size attribute. The size attribute specifies how large a font will be displayed in either relative or absolute terms. Close the <font> tag with </font> to return to a normal text size.

Can I change font on Word labels?

To change font properties, highlight the address, right-click, and click Font. Make your changes, and click OK. Still on the Labels window, click the New Document button at the bottom. A Word document will appear containing the labels.

How do I change the font size of data labels in Excel?

Click the data label and drag it to the size you want. Tip: You can set other size (Excel and PowerPoint) and alignment options in Size & Properties (Layout & Properties in Outlook or Word). Double-click the data label and then click Size & Properties.


2 Answers

I have tested this one on my side and it works as intended.

If you are loading the styles via a stylesheet it is possible that your browser has cached this, and you may need to clear browser caches.

Some browsers do also supply default values for most HTML elements. (Something to consider)

like image 113
Dylan Auty Avatar answered Sep 24 '22 10:09

Dylan Auty


EDIT: It turned out that cached CSS in Opera was responsible non-updating styling.

Working as required. Remember to re-run your code snippet after making changes.

.group {
  margin-bottom: 20px;
}
.group label {
  font-size: 10px;
}
.group2 label {
  font-size: 4px;
}
<div class="group">
  <label for="input1">First label</label>
  <input type="text" name="input1">
</div>
<div class="group group2">
  <label for="input2">Second label</label>
  <input type="text" name="input2">
</div>
like image 37
Maciej Caputa Avatar answered Sep 24 '22 10:09

Maciej Caputa