3 replies [Last post]
artofit
artofit's picture
Offline
newbie
Last seen: 8 years 28 weeks ago
Timezone: GMT+1
Joined: 2014-01-13
Posts: 7
Points: 9

Hello,

Is there a css way to format numbers as such.

1/ I want that the last digit of a decimal number is in small font.
Example
1.53
as
1.53

2/ I want negative numbers in red, decimal separator being dot, thousand seperator being comma
-123456.78
as

-123,456.78

Thanks

t-bone_two
t-bone_two's picture
Offline
Enthusiast
Los Angeles
Last seen: 6 years 35 weeks ago
Los Angeles
Timezone: GMT-6
Joined: 2009-09-26
Posts: 209
Points: 268

Do you have A Code Sample

It is difficult to determine what you want to do by reading your post. I am also not sure what a float has to do with what you want to achieve.

<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="Pragma" content="no-cache" />
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="video.css" rel="stylesheet">
<title>Untitled Document</title>
<style type = "text/css">
.red { color:#f00; }
.seven_five { font-size:.75em; }
</style>
</head>
<body>
<p>1.<span class = "red">2</span>381<span class = "seven_five">2645</span></p>
</body>
</html>

artofit
artofit's picture
Offline
newbie
Last seen: 8 years 28 weeks ago
Timezone: GMT+1
Joined: 2014-01-13
Posts: 7
Points: 9

I speaking about formating

I speaking about formating data, just as Excel does, if it is possible directly in CSS without JS.

http://www.mredkj.com/javascript/numberFormat.html
http://stackoverflow.com/questions/5731193/how-to-format-numbers-using-javascript

t-bone_two
t-bone_two's picture
Offline
Enthusiast
Los Angeles
Last seen: 6 years 35 weeks ago
Los Angeles
Timezone: GMT-6
Joined: 2009-09-26
Posts: 209
Points: 268

CSS Is a Styling Language

CSS is used to code design. It is a styling language to control the visual layout of the page. It is not used to make the browser do math . . . if that helps. It is used to place elements on the page and control how they look. It is "design code."

Hope that helps.