• css justify-content Test210428


    css justify-content Test210428

    用于测试flex弹性盒子下, 单个元素,多个元素,子元素还有子元素 在各种justify-content的选项下的效果,并且可以改变align-items

    测试代码

    
    DOCTYPE html><html lang="zh-CN"><head><meta charset="utf-8"/><title>css justify-content Test210428title>
    <style id="FirstStyleTag" >
    *{box-sizing:border-box;}
    fieldset{background:#fffddd}
    #BodyBody>fieldset>legend{font-size:36px; }
    .FlexBox{display:flex;  height:160px; border:1px solid black; }
    .FlexBox>*{display:flex; padding:10px; align-items:center; color:white;}
    .FlexBox>:nth-child(1){background-color:red;}
    .FlexBox>:nth-child(2){background-color:orange}
    .FlexBox>:nth-child(3){background-color:yellow}
    .FlexBox>:nth-child(4){background-color:green}
    .FlexBox>:nth-child(5){background-color:cyan}
    .FlexBox>:nth-child(6){background-color:blue}
    .FlexBox>:nth-child(7){background-color:purple}
    .FlexBox>:nth-child(8){background-color:#0099ff}
    .FlexBox>:nth-child(9){background-color:#9900ff}
    
    style><script>function dgebi(x){if(x && x.constructor===String)x=document.getElementById(x); return x;} ; function dcept(p,tn){var e=document.createElement(tn); p=dgebi(p).appendChild(e); return e;} ; const FirstStyleTag=dgebi("FirstStyleTag");
    
    var justifyContentOptions = [];
    justifyContentOptions.push("start");
    justifyContentOptions.push("flex-start");
    justifyContentOptions.push("end");
    justifyContentOptions.push("flex-end");
    justifyContentOptions.push("center");
    justifyContentOptions.push("left");
    justifyContentOptions.push("right");
    justifyContentOptions.push("baseline");
    justifyContentOptions.push("first-baseline");
    justifyContentOptions.push("last-baseline");
    justifyContentOptions.push("space-between");
    justifyContentOptions.push("space-around");
    justifyContentOptions.push("space-evenly");
    justifyContentOptions.push("stretch");
    justifyContentOptions.push("safe center");
    justifyContentOptions.push("safe left");
    justifyContentOptions.push("safe right");
    justifyContentOptions.push("safe flex-end");
    justifyContentOptions.push("unsafe center");
    justifyContentOptions.push("unsafe left");
    justifyContentOptions.push("unsafe right");
    justifyContentOptions.push("unsafe flex-end");
    
    console.info("FirstStyleTag.__proto__",FirstStyleTag.__proto__); console.log("FirstStyleTag.sheet",FirstStyleTag.sheet);
    
    script>head><body><header id="BodyHeader">
    	<p style="font-size:20px;" >justify-content : start | flex-start | end | flex-end | center | left | right | baseline | first-baseline | last-baseline | space-between | space-around | space-evenly | stretch | safe | unsafep>
    	<nav style="word-spacing:16px; "><label>导航: label><a href="#多元素容器010 ">多元素演示a>	<a href="#单元素容器010 ">单元素演示a>	<a href="#混合元素容器010 ">混合元素容器a>	<a href="# ">a>nav>
    	<nav id="SetAlignItemsBar"><label>切换align-items:为 label>nav>
    	<script>
    var SetAlignItemsBar = dgebi("SetAlignItemsBar");
    for(opt of justifyContentOptions){
    	let btn = dcept(SetAlignItemsBar , "button"); btn.type="button"; btn.innerText=opt; btn.onclick=function(ev){LastStyleTag.innerText=`.FlexBox{align-items:${ev.target.innerText};}`;}
    }
    	script>
    header><div id="BodyBody" style="position:fixed; top:200px; width:100%; height:80vh; overflow-y:auto; ">
    
    <fieldset><legend>多元素演示legend>
    	<div id="多元素容器010" >div>
    fieldset>
    <fieldset><legend>单元素演示legend>
    	<div id="单元素容器010" >div>
    fieldset>
    <fieldset><legend>混合元素演示legend>
    	<div id="混合元素容器010" >div>
    fieldset>
    
    
    
    
    
    div><footer id="BodyFooter">footer><script>const BodyHeader=dgebi("BodyHeader") , BodyBody=dgebi("BodyBody"), BodyFooter=dgebi("BodyFooter");
    var 多元素容器010 = dgebi("多元素容器010");
    var 单元素容器010 = dgebi("单元素容器010");
    var 混合元素容器010 = dgebi("混合元素容器010");
    
    function add多元素演示(opt){
    	var f=dcept(多元素容器010,"fieldset"); var l=dcept(f,"legend"); l.innerHTML=opt;
    	var flexBox=dcept(f,"div"); flexBox.className="FlexBox"; flexBox.style.justifyContent=opt;
    	for(let i=0; i<9; i++){let son=dcept(flexBox,"label"); son.innerHTML="label_"+i; };
    }
    for(opt of justifyContentOptions){add多元素演示(opt);}
    
    
    function add单元素演示(opt){
    	var f=dcept(单元素容器010,"fieldset"); var l=dcept(f,"legend"); l.innerHTML=opt;
    	var flexBox=dcept(f,"div"); flexBox.className="FlexBox"; flexBox.style.justifyContent=opt;
    	let son=dcept(flexBox,"span"); son.innerHTML="span"; 
    }
    for(opt of justifyContentOptions){add单元素演示(opt);}
    
    
    function add混合元素演示(opt){
    	var f=dcept(混合元素容器010,"fieldset"); var l=dcept(f,"legend"); l.innerHTML=opt;
    	var flexBox=dcept(f,"div"); flexBox.className="FlexBox"; flexBox.style.justifyContent=opt;
    	flexBox.innerHTML = `hellospan1world
    div1
    第二行
    第三行
    世界你好
    `
    } for(opt of justifyContentOptions){add混合元素演示(opt);}
    script><style id="LastStyleTag">style><script>var LastStyleTag=document.getElementById("LastStyleTag");script>body>html>
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115

    在这里插入图片描述

  • 相关阅读:
    盐酸左氧氟沙星修饰牛血清白蛋白,OFLX-BSA,bovine serum albumin-OFLX
    numpy array数组 数据增广造成的小问题
    python代码是如何执行的?
    【编程题】最小农田浇水费用
    编写脚本一键安装rsyslog
    Rasa系列教程(二) -- Rasa NLU基础
    请问大家有没有软考中项集成的考试技巧?
    跨平台编译QScintilla、安装QScintilla(Windows、Linux、MacOS环境下编译与安装)
    JAVA多线程并发(一):线程的创建
    工作中常见的两种谬误
  • 原文地址:https://blog.csdn.net/kfepiza/article/details/126239701