Css3 calc (), css3calcOverview
CSS Functionscalc()Can be used in any need.calc()You can determine the size and shape of an object through calculation.
You can alsoCalc () nested inside anothercalc().How to read the CSS syntax.
calc(expression)Value
Expression
A mathematical expression. The result of this expression is used as the final
.
Expression
In this expression, you can use the follow
First, preface
Calc () looks like a function in JavaScript, and in fact it is used in CSS, it can be used to calculate the length (width or height), can automatically adjust the value according to the different size of the screen automatically, making it easy to implement the adaptive layout display in different size screen. The project often encounters elements that are always centered, and of course the first thing to think about is using margin:0
What is a calc ()? Believe that the CSS3 Study more in-depth children's shoes on the function and use of the functions are more familiar with the new web front-end, this function is still relatively unfamiliar. In fact, Calc () is a new feature of CSS3 that specifies the length of the element, and we can also interpret it as a function of the functions. Today, I would like to share with you the role of CSS3
This time to bring you to use Calc () to achieve a responsive layout, with Calc () to achieve a responsive layout of the considerations are what, the following is the actual case, take a look.
Rem method
Calc () Literally we can interpret him as a function. In fact, Calc is the abbreviation for the English word Calc
Calc () may be a stranger to everyone, and it's unlikely to believe that Calc () is part of the CSS. But it is a part of the CSS3, the following article is mainly about the Calc function in the CSS3 of the relevant information, the text through the sample code introduced in very detailed, the need for friends can refer to the following
Objective
In fact, before
, line breaks, spaces, tabs, and so on, which produce whitespace characters, which are all in the final analysis, are controlled by font-size, and the size of the font directly results in the size of the void between the elements of inline or inline-block, The gap between the inline-block elements is that it is always wrong to have a fixed size.Also said that we use inline-box, in fact, the nature of the element is inline, but from a line, in fact, or box, so the white space, this is a historica
Article reproduced from W3cplus http://www.w3cplus.com/Original link: http://www.w3cplus.com/css3/how-to-use-css3-calc-function.htmlAbstract: Calc () literally we can interpret him as a functional function. In fact, Calc is the abbreviation for the English word Calculate (calculation), is a new function of CSS3, which is used to specify the length of the element.
of predecessors summed up an experience
Body {
font-size:62.5%;
}
So, then 1em = 10px in the layout of the use of time good conversion a lot. percentPercentage I believe that we will not be unfamiliar, the percentage generally speaking is relative to the parent element, but not very accurate. 1, for the general positioning element is our understanding of the parent element 2, for the Position:absolute element is relative to the defined parent element (offset parent) 3, the element fo
not be unfamiliar, the percentage is generally broadly speaking relative to the parent element, but not very accurate.
1, for the general positioning element is our understanding of the parent element
2. For Position:absolute, the element is relative to the positioned parent element (offset parent)
3. For position:fixed, the element is relative to ViewPort
Viewport: The visual window, which is the size of the browser windows.Exceptional cases
1, the use of padding
predecessors summed up an experiencebody {font-size: 62.5%;}So, after this 1em = 10px in the layout and so on when the use of good conversion of a lot.PercentagePercentages believe that we will not be unfamiliar, the percentage is generally broadly speaking relative to the parent element, but not very accurate.
1, for the general positioning element is our understanding of the parent element
2. For Position:absolute, the element is relative to the positioned parent element (offset
broadly speaking relative to the parent element, but not very accurate.
1, for the general positioning element is our understanding of the parent element
2. For Position:absolute, the element is relative to the positioned parent element (offset parent)
3. For position:fixed, the element is relative to ViewPort
Viewport: The visual window, which is the size of the browser windows.Exceptional cases
1, the use of padding, margin, etc., the actual percentage and the p
What is calc ()?Calc () is a new feature of CSS3 that can dynamically calculate length values, and any length value can be computed using calc (). You can give a DIV element, using percentages, EM, px, and REM unit values to calculate its width or height, such as "Width:calc (50% + 2em)", so you don't have to think about how much the element div's width value is,
CSS3 's Calc () usage briefly describes:Calc is an abbreviation for calculate (calculated meaning).Judging from the appearance of Calc (), it resembles a method in a programming language and has a computational function.Indeed, it can dynamically calculate the value of some elements in the CSS, and can use simple "+", "-", "*", "/" arithmetic.The basic rules are as follows:(1). You can use percentages, px,
As its name, Calc is the new computed attribute in CSS3, which allows many attributes to add an expression to the argument;
Calc is an abbreviation for the English word Calculate (calculation) and is a new feature of CSS3, and you can use Calc () to set dynamic values for attributes such as border, margin, pading, font-size, width, and height of the element.
How
Article reproduced from the Jones Taiwan Blog: http://www.qttc.net/201409448.htmlLess benefits Needless to say everyone knows, really let the person who writes CSS is not painful, recently I added Calc in less to find a bit of a problem, I wrote in less:
123
div {width : calc(100%- 30px);}
As a result, less took this as an arithmetic to execute, and the result gave me a resol
Calc is an abbreviation for the English word Calculate (calculation) and is a new feature of CSS3 that specifies the length of the element. This function allows you to perform simple arithmetic calculations, such as calculating the length and width of an element, eliminating the JavaScript code you write that is not easy to maintain. This function supports all simple basic arithmetic operations, including subtraction.When there are "+" and "-" in the
For the use of rem units, calc () for Adaptive LayoutUnit in css
We all know that units in css generally include px, %, em, and other units. In addition, css3 adds a new unit rem.
Px, %, and other units are frequently used in traditional la S, and you are familiar with them. However, px units are insufficient in the adaptive la S, most solutions use % in combination with @ media queries for Adaptive Layout. However, another newly added unit in css3 ca
This article mainly introduces the CSS3 calc in less compile the solution of the calculation of the relevant information, content is very good, and now share to everyone, but also for everyone to do a reference.
For front-end er, less or sass is already a necessary basic skill, with this tool, can save the front-end developers a lot of coding time, let you write css like flowing, and then recently I added Calc
About Calc () This CSS function, has too much effect, I believe that the friends of the CSS familiar with the function will not be unfamiliar, if you belong to this category, then you can skip, because this article is not very important, just a few basic introduction to it.Well, how did I get into this property, it must have been a problem at the time, and then discovered that there was this method. See:So because to achieve this effect, open really u
Before we want to achieve a perfect width adaptive input box is a good hassle, once also being a challenge to front-end technology. Similar common scenes also have 100% wide + border containers, and so on. In these situations, we have to be very careful because the performance of each browser may be inconsistent.
Now that Firefox and WebKit Support Calc (), we can also learn.
What does calc () do?
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.