Front-end Tutorials

Front-end Tutorials

HTMLCSSSassJavaScriptReactJS
CMS Tutorials

CMS Tutorials

WordPress
Tutorials expand

CSS Properties

CSS min-inline-size Property

Posted in CSS Tutorial
Updated on Oct 07, 2024
By Mari Selvan
👁️ 9 - Views
⏳ 4 mins
💬 1 Comment
CSS min-inline-size Property

Photo Credit to CodeToFun

🙋 Introduction

The min-inline-size property in CSS is used to set the minimum size of an element along the inline axis, which is the axis running in the direction of the text flow (left-to-right or right-to-left).

This property ensures that an element's width does not fall below a specified minimum value, helping to maintain layout consistency and avoid content overflow.

💡 Syntax

The syntax for the min-inline-size property is as follows:

Syntax
Copied
Copy To Clipboard
element {
  min-inline-size: size;
}

Here, size can be a length value, a percentage, or the keyword auto.

🎛️ Default Value

The default value of the min-inline-size property is auto, which means that there is no minimum size restriction applied, and the element can shrink as needed based on its content and surrounding layout.

🏠 Property Values

ValueDescription
lengthDefines a fixed minimum size, such as 200px, 10em, or 5rem.
percentageDefines a minimum size relative to the containing block’s inline size, such as 50%.
autoThe default value that means no minimum size is set.

📄 Example

In this example, we will set a minimum inline size for a <div> element to ensure it does not shrink below 300 pixels.

index.html
Copied
Copy To Clipboard
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>CSS min-inline-size Example</title>
  <style>
    .container {
      border: 1px solid black;
      min-inline-size: 300px;
    }
  </style>
</head>
<body>
  <h1>Element with Minimum Inline Size</h1>
  <div class="container">
    This container will not shrink below 300px in width.
  </div>
</body>
</html>

🖥️ Browser Compatibility

The min-inline-size property is supported in modern browsers, but support may vary across older versions. It is advisable to test the property in the browsers you target to ensure consistent behavior.

🎉 Conclusion

The min-inline-size property is useful for setting a minimum width for elements along the inline axis, helping to maintain layout integrity and prevent unwanted content overflow.

By using this property, you can ensure that your design remains consistent across different screen sizes and content variations. Experiment with different values to achieve the desired layout and responsiveness for your web projects.

👨‍💻 Join our Community:

To get interesting news and instant updates on Front-End, Back-End, CMS and other Frameworks. Please Join the Telegram Channel:

Author

author
👋 Hey, I'm Mari Selvan

For over eight years, I worked as a full-stack web developer. Now, I have chosen my profession as a full-time blogger at codetofun.com.

Buy me a coffee to make codetofun.com free for everyone.

Buy me a Coffee

Share Your Findings to All

Subscribe
Notify of
guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
We make use of cookies to improve our user experience. By using this website, you agree with our Cookies Policy
AgreeCookie Policy