Tutorialsteacher

Follow Us

Articles
  • C#
  • C# OOP
  • ASP.NET Core
  • ASP.NET MVC
  • LINQ
  • Inversion of Control (IoC)
  • Web API
  • JavaScript
  • TypeScript
  • jQuery
  • Angular 11
  • Node.js
  • D3.js
  • Sass
  • Python
  • Go lang
  • HTTPS (SSL)
  • Regex
  • SQL
  • SQL Server
  • PostgreSQL
  • MongoDB
  • Sass - Get Started
  • What is Sass
  • Sass - Setup Environment
  • Sass - Syntax
  • Sass - Variable
  • Sass - Script
  • Sass - Data Types
  • Sass - Operators
  • Sass - Functions
  • String Functions
  • Numeric Functions
  • List Functions
  • Map Functions
  • Selector Functions
  • Introspection Functions
  • Color Functions
  • Control Directives
  • Import Files and Partials
  • Sass - Mixins
  • Sass - Inheritance
Entity Framework Extensions - Boost EF Core 9
  Bulk Insert
  Bulk Delete
  Bulk Update
  Bulk Merge

Sass - Numeric Functions

As with the string functions, Sass provides a basic set of functions for manipulating numeric values, and they work the way you'd expect them to. Note that you can provide CSS value descriptors such as "px" or "rem" to all the functions except percentage(). Sass will ignore the units, and they won't included in the result.

FunctionDescriptionExamplesResult
percentage($number)Converts a unitless number to a percentage; i.e., multiplies it by 100percentage(1.5)150
percentage(1em)syntax error
round($number)Rounds a number to the nearest whole numberround(7.25)7
round(7.5)8
ceil($number)Rounds a number up to the nearest whole numberceil(7.25)8
floor($number)Rounds a number down to the nearest whole numberfloor(7.75)7
abs($number)Returns the absolute value of a numberabs(7)7
abs(-7)7
min($numbers)Returns the smallest value in a list of numbersmin(3, 5, -2, 7, 0)-2
max($numbers)Returns the largest value in a list of numbersmax(3, 5, -2, 7, 0)7
random()Returns a random value larger than 0 and smaller than 1random()0.87267
random($limit)Returns a random whole number between 1 and the number specified by $limit, inclusiverandom(4)3
TUTORIALSTEACHER.COM

TutorialsTeacher.com is your authoritative source for comprehensive technologies tutorials, tailored to guide you through mastering various web and other technologies through a step-by-step approach.

Our content helps you to learn technologies easily and quickly for learners of all levels. By accessing this platform, you acknowledge that you have reviewed and consented to abide by our Terms of Use and Privacy Policy, designed to safeguard your experience and privacy rights.

[email protected]

ABOUT USTERMS OF USEPRIVACY POLICY
copywrite-symbol

2024 TutorialsTeacher.com. (v 1.2) All Rights Reserved.