CSS style not recognizing numbers
If class
& ID
is start from number then is not recognized by css. But you can write like this .plans3
instead of .3plans
.
As per W3c
In CSS, identifiers (including element names, classes, and IDs in
selectors) can contain only the characters [a-z0-9] and ISO 10646
characters U+00A1 and higher, plus the hyphen (-) and the underscore
(_); they cannot start with a digit, or a hyphen followed by a digit.
Identifiers can also contain escaped characters and any ISO 10646
character as a numeric code (see next item). For instance, the
identifier "B&W?" may be written as "B\&W\?" or "B\26 W\3F".
Check this discussion for more Which characters are valid in CSS class names/selectors?
CSS class starting with number is not getting applied
For classes starting with numbers, you'll need to write
.\32 00-200 {
width: 200px;
height: 200px;
}
You'll probably want to avoid doing that.
The \32
represents the digit "2". The space following it is necessary to terminate the escape sequence.
The reason for this is that "CSS identifiers" may not start with numbers. In CSS, class names used in selectors are considered "CSS identifiers". Therefore, the leading number must be escaped in the way shown above. Note that there is no restriction from the HTML perspective on class names, other than they may not contain spaces. So you could write <div class="%^*+lt;"
, as long as you were willing to figure out how to write that in escaped form in your CSS file.
See the question suggested as a duplicate for more information.
Is there a reason why CSS doesn't support ids and classes, starting from numbers?
In fact, the specification states that classes starting with a number will be interpreted as a dimension [1]:
CSS2 parses a number immediately followed by an identifier as a DIMENSION token (i.e., an unknown unit), CSS1 parsed it as a number and an identifier. That means that in CSS1, the declaration 'font: 10pt/1.2serif' was correct, as was 'font: 10pt/12pt serif'; in CSS2, a space is required before "serif". (Some UAs accepted the first example, but not the second.)
and since we don't know which dimensions will be introduced in the future, dimensions that do not exist in CSS are parsed as unknown dimensions:
In CSS1, a class name could start with a digit (".55ft"), unless it was a dimension (".55in"). In CSS2, such classes are parsed as unknown dimensions (to allow for future additions of new units). To make ".55ft" a valid class, CSS2 requires the first digit to be escaped (".\35 5ft")
You can use class starting with numbers by escaping the first digit, which is valid according to the W3C CSS validator. check out the plunkr.
[1] Appendix G. Grammar of CSS 2.1
HTML ID with numerical value not recognized by CSS
Although it's allowed to set a class
or id
to begin with a digit in HTML5, but it's not allowed in CSS, see the spec:
HTML5: 3.2.5.1 The id attribute
... There are no other restrictions on what form an ID can take; in particular, IDs can consist of just digits, start with a digit, start with an underscore, consist of just punctuation, etc. ...
CSS: 4.1.3 Characters and case
... they cannot start with a digit, two hyphens, or a hyphen followed by a digit. Identifiers can also contain escaped characters and any ISO 10646 character as a numeric code ...
i.e.
<div id="1">
is valid HTML, but you cannot target it with #1 {...}
in CSS.
However, you can use [id="1"] {...}
or escape it #\31 {...}
styling with numbers for number formats using css
just use a CSS class for it or use inline style like this, here is the example:
while($row = mysqli_fetch_array($em)){
$amount = $row['amount'];
$formated_number = number_format($amount, 0);
echo '<span style="color:#000000;font-weight:bold;font-size:24px;">'.$formated_number.'</span>'
}
Can you style ordered list numbers?
You can do this using CSS counters, in conjunction with the :before
pseudo element:
ol { list-style: none; counter-reset: item; } li { counter-increment: item; margin-bottom: 5px; } li:before { margin-right: 10px; content: counter(item); background: lightblue; border-radius: 100%; color: white; width: 1.2em; text-align: center; display: inline-block; }
<ol> <li>item</li> <li>item</li> <li>item</li> <li>item</li></ol>
HTML CSS Issues in implementing nested ordering which includes numbers, alphabets and roman numbers
You were wrong in the use of your :before
and the list counter
CSS property. Also you probably got lost in CSS selectors and ended up with undesired effects.
I fixed it for you, hopefully this is what you were looking for
li { display: block}
.main-num-list, .sub-num-list { counter-reset: item}
.main-num-list>li:before,.sub-num-list>li:before { content: counters(item, ".") " "; counter-increment: item}
.sub-albhabatical-list { counter-reset: letter;}
.sub-albhabatical-list > li:before { content: counter(letter, lower-alpha) ". "; counter-increment: letter;}
.sub-roman-list { counter-reset: roman;}
.sub-roman-list > li:before { content: counter(letter, lower-roman) ". "; counter-increment: roman;}
<div class="layout__wrapper">
<ol class="main-num-list">
<li>Main Line 111111111 <ol class="sub-num-list"> <li>Sub Line 111111111 <ol class="sub-albhabatical-list"> <li>CSS Style Not Recognizing Numbersaaa</li> <li>bbb</li> </ol> </li>
</ol> </li>
<li>Main Line 22222222 <ol class="sub-num-list"> <li>Sub Line 111111111 <ol class="sub-albhabatical-list"> <li>CSS Style Not Recognizing Numbersaaa</li> <li>bbb</li> </ol> </li> <li>Sub Line 22222222 <ol class="sub-albhabatical-list"> <li>CSS Style Not Recognizing Numbersaaa <ol class="sub-roman-list"> <li>moreeeeee</li> <li>moreeeeee</li> </ol> </li> <li>bbb <ol class="sub-roman-list"> <li>moreeeeee</li> <li>moreeeeee</li> </ol> </li> </ol> </li> <li>Sub Line 111111111 <ol class="sub-albhabatical-list"> <li>CSS Style Not Recognizing Numbersaaa</li> <li>bbb</li> </ol> </li> </ol> </li> </ol></div>
Related Topics
I Need Help Making CSS for a Modern Vertical Navbar
Class Selector Not Working in CSS, But Id Works for Add Some Styles
How to Animate Path Shape Without Using Smil
Overlaping Effect on Cards with Pure CSS
How to Achieve This Visual Using CSS
Bootstrap 3 - Change Dropdown Background Colour
Center Vertically The Content of a Div ( Not by Line-Height )
Twitter Bootstrap 3 Modal with Scrollable Body
Bootstrap 3: Using Img-Circle, How to Get Circle from Non-Square Image
How to Change Bootstrap Carousel Indicators into Dots
Why Is My Bootstrap Column Centered Instead of Left-Aligned
A Styled Ordered List Whose Nested List Should Have Numbers with Letters Using CSS Counter Property
Loops Make Less to Run Out of Memory. (Structure Optimization)
Vuetify Without Vue-Cli Sass/Scss Conflict
Apply a Class and an Attribute Selector
How to Target All Divs of The Same Class Except for Hovered Over Div
Firefox Parsing 4 Digit Hex Color Values as Rgba
How to Refer to an Internal Gradient Definition Inside an Svg Sprite Symbol