Can i use the rest size of a variable? [duplicate] - css

This question already has answers here:
How to make a div fill a remaining horizontal space?
(26 answers)
Closed 7 years ago.
I have 2 Divs. They are both floating left and div1 has a variable.
#div1: 8%;
The HTML is:
<div class="div1">Icon</div>
<div class="div2">Big Text</div>
Can I tell the div2 that it has to use the rest of the width? So, in this case that should be 92%. How can I do this without creating a second variable? The 2 divs together have to be 100% wide.

In all seriousness, it would've been faster for you to either try or read the starters manual than to ask this question.
#div1: 8%;
.selector {
width: 100% - #div1; //Evaluates to 92%
}

Related

How to make a footer with a curved top border? [duplicate]

This question already has answers here:
Can I create a div with a Curved bottom?
(5 answers)
Curve bottom side of the div to the inside with CSS
(2 answers)
How to create uneven rounded sides on a div?
(1 answer)
Closed 1 year ago.
I'm bad with font end design and i'm trying to make a footer with a specific shape in css. Here is the shape i want to have:
Do you know how to do it ? And if it is possible with a responsive behaviour.
I tried border-radius:
border-top-left-radius: 50% 20%;
border-top-right-radius: 50% 20%;
But the it is not what i expected.
Thanks a lot for your time.
the easy way you can achieve this is to create import the curve as image an use it for footer background.
or you can use:
border-redius

CSS High precision measurements, inputs, simple form [duplicate]

This question already has answers here:
How to make an element width: 100% minus padding?
(15 answers)
Closed 1 year ago.
I am firts know.
Can someone modify this example for me, but that the measurements are totally exact in horizontal? (and auto ajust size screen offcourse).
Code:
https://www.w3schools.com/code/tryit.asp?filename=GQ2J7FETCPBY
Very thanks.
add css
* {
box-sizing: border-box;
}

How do I make sure that the images aren't stretching either horizontally or vertically [duplicate]

This question already has answers here:
CSS force image resize and keep aspect ratio
(26 answers)
Closed 1 year ago.
They should only be resized on one of the two dimensions, whichever is bigger.
If you look at the puppy image below, it looks to be stetched
CODE
export const ImageTemplateImage = styled.img`
width: 230px;
height: 162.53px;
`;
If you don't give in a height for example, it will keep the ratio and only change the width.
Therefore the height may not be set.
At least is in css, I'm not familiar with reactjs, but I'm guessing this is an injection into the css.

Bootstrap - two divs in a row, one fixed, one flexible [duplicate]

This question already has answers here:
Expand a div to fill the remaining width
(21 answers)
How to build a 2 Column (Fixed - Fluid) Layout with Twitter Bootstrap?
(2 answers)
Closed 2 years ago.
I try to get two divs in a row. One fixed (220px), the other fills the rest of the page so it's always 100% in total.
I've also read similar threads like this one:
Two divs in one row
I tried several approaches, Bootstrap, Flexbox, Floating Divs, in the end I used calc, but I couldn't get 100% accurate results.
My favorite approach would be with Bootstrap, but I couldnt get this to work, no matter if with a grid or other options.
The actual approach seems kinda messy: Whenever I use calc() and substract the same width of the first container, it's displayed in a second row. Only when I substract 4px more, it's shown in the same line.
I guess this is the right and the left border of both divs or so. There's also a little margin between the divs, even if I set margin to 0px.
<div style="width:220px; display:inline-block; background-color:#F00; margin: 0px;">
1
</div>
<div style="width: calc(100% - 224px); display:inline-block; background-color:#FF0; margin: 0px;">
2
</div>
My question is easy: How can I do this accuratly?

Can't make height: 50% [duplicate]

This question already has answers here:
Percentage Height HTML 5/CSS
(7 answers)
Closed 8 years ago.
I'm trying to have two divs above and below each other, both of which take up 50% of the screen.
My site is here and the divs in question are #intro and #services. Any idea what I'm doing wrong?
Add html,body{height:100%;} to your code.

Resources