내가 플렉스 레이아웃 행으로 일부 콘텐츠를 넣어 노력하고 내가CSS : 인 flexbox 레이아웃 정적 만들기
- 행이
가 대신 내가 만들려고 자신의 콘텐츠와 폭 크기를 조절 것으로 나타났습니다 행의 너비가 정적이므로, 더 큰 모든 자식이 중단됩니다.
CodeMirror 편집기는 해당 행에 더 큰 하위 자식이있는 문제를 보여주기 위해 사용됩니다.
내가 그렇게 할 것입니다 방법이 Fiddle
#main {
display: flex;
justify-content: space-between;
height: 100vh;
.flex {
width: 100%;
&:nth-child(2) {
background: red;
}
#wrapper #item {
background: blue;
}
}
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/codemirror.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/addon/scroll/simplescrollbars.min.css">
<script type="text/javascript" src ="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/codemirror.min.js">
<script type="text/javascript" src ="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/addon/scroll/simplescrollbars.js">
<script type="text/javascript" src ="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/mode/javascript/javascript.min.js">
<script type="text/javascript" src ="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js">
<script type="text/javascript">
$(document).ready(function(){
\t var ce = document.getElementById("item");
var myCodeMirror = CodeMirror(function(node){ce.parentNode.replaceChild(node, ce);}, {
value: "function myScript(){return 100;}",
mode: "javascript",
lineSeparator: null,
theme: "default", // theme directory
indentUnit: 2,
smartIndent: true,
tabSize: 2,
indentWithTabs: false,
electricChars: true,
extraKeys: null,
lineWrapping: false,
lineNumbers: true,
firstLineNumber: 1,
scrollbarStyle: "overlay",
inputStyle: "contenteditable",
readOnly: false, // also "nocursor"
showCursorWhenSelecting: false,
lineWiseCopyCut: true,
undoDepth: 200,
historyEventDelay: 1250,
autofocus: true
});
});
</script>
<div id="main">
<div class="flex">ABC</div>
<div class="flex">
DEF
<div id="wrapper">
<div id="item">
</div>
</div>
</div>
<div class="flex">GHI</div>
</div>
에서보세요?
어쩌면 그것의 애매한 것이지만 * 더 큰 모든 아이들이 * 깨지도록 * 당신은 무엇을 의미합니까? – kukkuz
@kukkuz 아이의 너비가 플렉스 컬럼의 너비보다 큰 경우, 플렉스 컬럼은 아이의 너비와 일치하도록 너비가 확장됩니다. 아이의 폭을 플렉스 컬럼의 너비로 제한하려고합니다. 질문에서 링크 된 바이올린을보고 내가 의미하는 바를 확인하십시오. – jonhue
'main' (플렉스 박스) * 내부에 3 개의 플렉스 아이템이 있습니다. * 플렉스 컬럼의 너비는 무엇을 의미합니까? (각 플렉스 * 아이템의 폭은 내용에 따라 다릅니다) – kukkuz