Questions tagged [calc]

calc refers to anything remotely related to anything about calculating anything. Because of its vague purpose, it should be avoided.

refers to anything remotely related to anything about calculating anything. Because of its vague purpose, it should be avoided.

383 questions
36
votes
4 answers

Use screen.width inside calc (css)

Is there a was of using screen.width inside calc? Something like this: left: calc(250px + screen.width - 1024px)!important; It is for a concrete situation where the @media(max-width: 1024px) won't work.
Sefean
  • 420
  • 1
  • 6
  • 11
36
votes
5 answers

Set Parent Width equal to Children Total Width using only CSS?

I don't know how many .child elements .parent will contain but I know their individual width. I want to set the width of .parent to be equal to (width of each .child) * (total number of .child) I don't want to use floats and width: auto; Can I do…
Sprout Coder
  • 2,860
  • 9
  • 30
  • 47
28
votes
4 answers

Is it possible to get a negative value with CSS calc()?

Let's say we have a container that is centered in the viewport ... .centered{margin: 0 auto; width:960px;} ... and inside that container I have another that needs to have a width of 100% the viewport width. I could set the margin to…
Jayx
  • 3,486
  • 3
  • 26
  • 35
23
votes
3 answers

How can I convert hexadecimal to decimal numbers in calc of Emacs?

How can I convert hexadecimal to decimal numbers in Emacs calc? For example, if I enter FF, I want it to convert it to 255. UPDATE: How do I get the reverse operation, turn base 10 to base 16?
1.618
  • 779
  • 1
  • 10
  • 16
22
votes
3 answers

CSS - Use calc() to keep widths of elements the same

Is something like this possible in CSS?
elementOne elementtwo
So that the div is…
Marc M.
  • 3,052
  • 3
  • 25
  • 51
17
votes
1 answer

display: flex; vs calc(); performance

I came up today in a discussion where I'm wondering what is the most performant way of having two div's beside each other. On one side, i love using display:flex;, on the other side there is the option to use calc(), the reason is our div has…
15
votes
3 answers

Why is calc(50% + 0) an error?

When testing out some new layouts, I found myself writing at one point .test1 {width: calc(50% + 0);} and to my surprise, it didn't work. After verifying that I didn't have a typo anywhere, I was forced to conclude that the browser rejected this as…
Mr Lister
  • 42,557
  • 14
  • 95
  • 136
14
votes
5 answers

Bigger fonts on smaller screens without @media queries or javascript?

Is there an alternative for @media queries to accomplish font-size inversely proportional to the screen size? (e.g.: opposite effect of 2vw, where the font gets smaller on small screens); My first try was divide a value by a viewport width…
Le____
  • 6,107
  • 3
  • 25
  • 53
14
votes
2 answers

what language do I need to write macros in LIbre Office Calc?

I've written a bunch of VBA code for various things in Excel. I'm looking at migrating to libreOffice. Under Tool->Macros->Organize Macros: the two choices are LibreOffice Basic and Python. Should I learn one of those, both, or something else. Am…
DBWeinstein
  • 6,527
  • 29
  • 61
  • 102
13
votes
3 answers

Margin Top 100% - Height of Parent Div

I have the following layout to build: Basically, I need three divs of varying height with varying header heights to be positioned 100% from the top of their parent, minus the height of the header. I could do this with jQuery, but this is a…
JacobTheDev
  • 14,624
  • 23
  • 83
  • 146
12
votes
3 answers

Is it possible to use CSS calc() in order to calculate an width/height ratio?

This is the code which I currently have (it does not work yet): HTML:
CSS: .chi_display_header { background-size:contain; …
Blackbam
  • 12,200
  • 19
  • 71
  • 117
9
votes
2 answers

Is there a way to remove units from a calc function in CSS

I'm currently using the following rule: margin-left: calc(((100vw - 624px) / 144) * 5); At 1200px viewport width this gives a value of 20px. What I actually want, however, is to get a result of 20%. Ideally that would mean changing the…
RickL
  • 454
  • 1
  • 4
  • 13
9
votes
1 answer

Does calc() work for background size of image in CSS?

My question is very simple, does calc() work for background size of a background image in pure CSS... Right now I am fixing a background image for responsive mobile view... I want the image to stay fixed in ratio of the screen but resize on any…
SaurabhLP
  • 3,468
  • 7
  • 35
  • 67
8
votes
2 answers

ODS file to JSON

I would like to convert my speadsheet of data to a JSON array of array. This site do it: http://www.shancarter.com/data_converter/index.html And I looked into the source code. But what I would like is a macro / script / extension or any way to…
damio
  • 5,260
  • 3
  • 32
  • 50
8
votes
3 answers

LibreOffice SUM time period in format HH:MM:SS

I want to obtain the sum of several cells containing a period of time in the format HH:MM:SS. In LibreOffice Calc 4.0.3.3, I've copy-pasted the periods of time in the range G14:G21, and formatted the cells as Time HH:MM:SS. I formatted in the same…
Gianluca
  • 5,177
  • 16
  • 39
  • 63
1
2 3
25 26