YouTip LogoYouTip

Css3 Pr Box Flex

CSS3 box-flex Property .sidebar { background-color: #f8f9fa; padding: 20px; border-radius: 8px; margin-bottom: 20px; } .content { padding: 20px; } pre { background-color: #f4f4f4; border: 1px solid #ddd; padding: 15px; border-radius: 5px; overflow-x: auto; } code { font-family: 'Courier New', monospace; background-color: #f4f4f4; padding: 2px 5px; border-radius: 3px; } .footer { text-align: center; margin-top: 40px; color: #6c757d; font-size: 0.9em; }

CSS3 box-flex Property

-- Learning not just technology, but also dreams!

CSS Reference Manual

CSS Properties

CSS3 box-flex Property

The box-flex property is used to define the flexibility of a flex item within a flex container.

Syntax

box-flex: <number>;

Values

  • <number>: Specifies the flex factor of the element. The default value is 0. A higher number means greater flexibility (i.e., more space it will take).

Example

<!DOCTYPE html>
<html>
<head>
<style>
.flex-container {
  display: flex;
  width: 300px;
  height: 100px;
  background-color: #f1f1f1;
}

.flex-item {
  background-color: #4CAF50;
  margin: 5px;
  color: white;
  text-align: center;
  line-height: 100px;
  font-size: 20px;
}

.item-1 {
  box-flex: 1;
}

.item-2 {
  box-flex: 2;
}

.item-3 {
  box-flex: 3;
}
</style>
</head>
<body>

<div class="flex-container">
  <div class="flex-item item-1">1</div>
  <div class="flex-item item-2">2</div>
  <div class="flex-item item-3">3</div>
</div>

</body>
</html>

This example demonstrates how different values of box-flex affect the size distribution among flex items.

Browser Support

The box-flex property is supported in:

  • Chrome 20+
  • Firefox 18+
  • Safari 6+
  • Opera 12.1+
  • Internet Explorer 10+

Note: This property has been replaced by the flex property in modern CSS. It is recommended to use flex instead for new projects.

© 2025 . All rights reserved.

← Css3 Pr Box Flex GroupCss3 Pr Box Direction β†’