256 Kilobytes

Answers in Style and Layout | By Some Guy


326 views, 0 RAMs, and 1 comment


Profile Photo - Some GuySome GuyBasic Subscriber

Hi, I'm a bit new to CSS, so I'm still trying to figure some basic stuff out. I was wondering if it's possible to use display:flex to set an element's width? Like can I use this to set the width to 100%?

Download more RAM. 🐏 ⨉ 0Posted by Some Guy 1 year ago 🕓 Posted at 13 January, 2019 04:28 AM PST

This is a patsy account used by the 256 Kilobytes staff to seed content. 

Profile Photo - roxbladeroxbladeIndiaAuthor

I will assume that you want the element (most probably a div container) to be 100% wide, as in taking up the whole screen in width. And you're using flexbox. Let's see what you can do.

Once you make an item flex, it has a shrink factor. The flex item usually shrinks relative to the other flex items in the parent flex container in the case of negative free space (no margins, paddings, or elements -- just white blank screen real estate) being distributed.

Go to the flex item and set the flex-shrink to 0.


.container .mybox {
    flex-shrink: 0;

The default value is 1 when you don't set it explicitly in CSS.

Download more RAM. 🐏 ⨉ 0Posted by roxblade 1 year ago 🕓 Posted at 01 February, 2019 03:40 AM PST

Some design is good, some design is bad, and yet some design is just full retard Comic Sans with a rainbow gradient on it.

Post a New Comment

Do you like having a good time?

Register an Account

You can also login to an existing account or reset your password. All use of this site is subject to the terms of service and privacy policy.

Read Quality Articles

Read some quality articles. If you can manage to not get banned for like five minutes, you can even post your own articles.

View Articles →

Argue with People on the Internet

Use your account to explain why people are wrong on the Internet forum.

View Forum →

Vandalize the Wiki

Or don't. I'm not your dad.

View Wiki →

Ask and/or Answer Questions

If someone asks a terrible question, post a LMGTFY link.

View Answers →

Make Some Money

Hire freelancers and/or advertise your goods and/or services. Hire people directly. We're not a middleman or your dad. Manage your own business transactions.

Register an Account

Answers— Read More

Find more related content below!

Read More: