CSS 自測題 -- 用 flex 布局繪制骰子(一、二、三【含斜三點】、四、五、六點)

一點

在這里插入圖片描述

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>css flex布局-畫骰子</title><style>.box {margin: 20px;height: 100px;width: 100px;border: 2px solid grey;border-radius: 10px;/* 容器內元素使用flex布局 */display: flex;/* 主軸居中對齊 */justify-content: center;}.point {border-radius: 50%;height: 20px;width: 20px;background: black;/* align-self 寫在子元素上,覆蓋父元素指定的交叉軸對齊方式 */align-self: center;}</style></head><body><div class="box"><div class="point"></div></div></body>
</html>

兩點

在這里插入圖片描述

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>css flex布局-畫骰子</title><style>.box {margin: 20px;height: 100px;width: 100px;border: 2px solid grey;border-radius: 10px;/* 容器內元素使用flex布局 */display: flex;/* 主軸改為縱向 */flex-direction: column;/* 主軸(縱向)絕對均勻對齊(子元素間距以及兩端邊緣間距都相等) */justify-content: space-evenly;/* 交叉軸(橫向)居中對齊 */align-items: center;}.point {border-radius: 50%;height: 20px;width: 20px;background: black;}</style></head><body><div class="box"><div class="point"></div><div class="point"></div></div></body>
</html>

三點

簡易版

在這里插入圖片描述

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>css flex布局-畫骰子</title><style>.box {margin: 20px;height: 100px;width: 100px;border: 2px solid grey;border-radius: 10px;/* 容器內元素使用flex布局 */display: flex;/* 主軸改為縱向 */flex-direction: column;/* 主軸(縱向)絕對均勻對齊(子元素間距以及兩端邊緣間距都相等) */justify-content: space-evenly;/* 交叉軸(橫向)居中對齊 */align-items: center;}.point {border-radius: 50%;height: 20px;width: 20px;background: black;}</style></head><body><div class="box"><div class="point"></div><div class="point"></div><div class="point"></div></div></body>
</html>

復雜版

在這里插入圖片描述

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>css flex布局-畫骰子</title><style>.box {margin: 20px;height: 100px;width: 100px;border: 2px solid grey;border-radius: 10px;padding: 10px;box-sizing: border-box;/* 容器內元素使用flex布局 */display: flex;/* 主軸(橫向)相對均勻對齊(子元素間距相等,兩端邊緣間距為子元素間距的一半) */justify-content: space-between;}/* 第一個子元素,交叉軸默認起點對齊 */.point {border-radius: 50%;height: 20px;width: 20px;background: black;}.point:nth-child(2) {/* 第二個子元素,交叉軸居中對齊 */align-self: center;}.point:nth-child(3) {/* 第三個子元素,交叉軸終點對齊 */align-self: flex-end;}</style></head><body><div class="box"><div class="point"></div><div class="point"></div><div class="point"></div></div></body>
</html>

四點

在這里插入圖片描述

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>css flex布局-畫骰子</title><style>.box {margin: 20px;height: 100px;width: 100px;border: 2px solid grey;border-radius: 10px;padding: 10px;box-sizing: border-box;/* 容器內元素使用flex布局 */display: flex;/* 將主軸改為縱向 */flex-direction: column;/* 主軸(縱向)絕對均勻對齊(子元素間距以及兩端邊緣間距都相等) */justify-content: space-evenly;}.row {/* 每行內元素使用flex布局 */display: flex;/* 主軸(橫向)絕對均勻對齊(子元素間距以及兩端邊緣間距都相等) */justify-content: space-evenly;}.point {border-radius: 50%;height: 20px;width: 20px;background: black;}</style></head><body><div class="box"><div class="row"><div class="point"></div><div class="point"></div></div><div class="row"><div class="point"></div><div class="point"></div></div></div></body>
</html>

五點

在這里插入圖片描述

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>css flex布局-畫骰子</title><style>.box {margin: 20px;height: 100px;width: 100px;border: 2px solid grey;border-radius: 10px;padding: 10px 16px;box-sizing: border-box;/* 容器內元素使用flex布局 */display: flex;/* 將主軸改為縱向 */flex-direction: column;/* 主軸(縱向)絕對均勻對齊(子元素間距以及兩端邊緣間距都相等) */justify-content: space-evenly;}.row1 {/* 每行內元素使用flex布局 */display: flex;/* 主軸(橫向)相對均勻對齊 */justify-content: space-between;}.row2 {/* 每行內元素使用flex布局 */display: flex;/* 主軸(橫向)居中對齊 */justify-content: center;}.point {border-radius: 50%;height: 20px;width: 20px;background: black;}</style></head><body><div class="box"><div class="row1"><div class="point"></div><div class="point"></div></div><div class="row2"><div class="point"></div></div><div class="row1"><div class="point"></div><div class="point"></div></div></div></body>
</html>

六點

在這里插入圖片描述

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>css flex布局-畫骰子</title><style>.box {margin: 20px;height: 100px;width: 100px;border: 2px solid grey;border-radius: 10px;padding: 10px 16px;box-sizing: border-box;/* 容器內元素使用flex布局 */display: flex;/* 將主軸改為縱向 */flex-direction: column;/* 主軸(縱向)相對均勻對齊 */justify-content: space-between;}.row {/* 每行內元素使用flex布局 */display: flex;/* 主軸(橫向)絕對均勻對齊 */justify-content: space-evenly;}.point {border-radius: 50%;height: 20px;width: 20px;background: black;}</style></head><body><div class="box"><div class="row"><div class="point"></div><div class="point"></div></div><div class="row"><div class="point"></div><div class="point"></div></div><div class="row"><div class="point"></div><div class="point"></div></div></div></body>
</html>

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/713346.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/713346.shtml
英文地址,請注明出處:http://en.pswp.cn/news/713346.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

vue3 滾動條觸底監聽

問題&#xff1a;指定區域內&#xff0c;顯示返回的數據&#xff0c;要求先顯示20條&#xff0c;區域超出部分滾動顯示&#xff0c;對滾動條進行監聽&#xff0c;滾動條觸底后&#xff0c;繼續顯示下20條... 解決過程&#xff1a; 1.在區域的div上&#xff0c;添加scroll事件…

Unity 切換場景

場景切換前必須要將場景拖動到Build中 同步加載場景 using System.Collections; using System.Collections.Generic; //using UnityEditor.SearchService; using UnityEngine; // 場景管理 需要導入該類 using UnityEngine.SceneManagement;public class c3 : MonoBehaviour {…

redis五大基礎類型【重點】

之前寫過一點小知識&#xff1a;https://blog.csdn.net/qq_45927881/article/details/134959181?spm1001.2014.3001.5501 參考鏈接 https://xiaolincoding.com/redis/data_struct/command.html#%E4%BB%8B%E7%BB%8D 目錄 1. string&#xff08;字符串&#xff09;2. Hash&#…

MySql安全加固:配置不同用戶不同賬號禁止使用舊密碼禁止MySql進程管理員權限

MySql安全加固&#xff1a;配置不同用戶不同賬號&禁止使用舊密碼&禁止MySql進程管理員權限 1.1 檢查是否配置不同用戶不同賬號1.2 檢查是否禁止使用舊密碼1.3 禁止MySql進程管理員權限 &#x1f496;The Begin&#x1f496;點點關注&#xff0c;收藏不迷路&#x1f496…

【c++】通訊錄管理系統

1.系統功能介紹及展示 2.創建項目 3.菜單實現 4.退出功能實現 5.添加聯系人—結構體設計 6.添加聯系人—功能實現 7.顯示聯系人 8.刪除練習人—檢測聯系人是否存在 9.刪除聯系人—功能實現 10.查找聯系人 11.修改聯系人 12.清空通訊錄 #include <iostream> #include <…

什么是VR虛擬社區|VR元宇宙平臺|VR主題館加盟

VR虛擬社區是指一種基于虛擬現實技術構建的在線社交平臺或環境&#xff0c;用戶可以在其中創建虛擬化的個人形象&#xff08;也稱為avatars&#xff09;并與其他用戶進行交流、互動和合作。在VR虛擬社區中&#xff0c;用戶可以選擇不同的虛擬場景和環境&#xff0c;如虛擬公園、…

fly-barrage 前端彈幕庫(3):滾動彈幕的設計與實現

項目官網地址&#xff1a;https://fly-barrage.netlify.app/&#xff1b; &#x1f451;&#x1f40b;&#x1f389;如果感覺項目還不錯的話&#xff0c;還請點下 star &#x1f31f;&#x1f31f;&#x1f31f;。 Gitee&#xff1a;https://gitee.com/fei_fei27/fly-barrage&a…

顯示器開機正常,插入HDMI線卻不顯示畫面,換了HDMI線還是不行?

環境&#xff1a; 惠普/P24VG4 DELL筆記本 問題描述&#xff1a; 顯示器開機正常&#xff0c;插入HDMI線卻不顯示畫面&#xff0c;換了HDMI線還是不行&#xff0c;是不是顯示器壞了&#xff1f; 解決方案&#xff1a; 1.前往顯示器設置菜單里面查看input 2.把輸入源默認設…

二百二十五、海豚調度器——用DolphinScheduler調度執行Flume數據采集任務

一、目的 數倉的數據源是Kafka&#xff0c;因此離線數倉需要用Flume采集Kafka中的數據到HDFS中 在實際項目中&#xff0c;不可能一直在Xshell中啟動Flume任務&#xff0c;一是項目的Flume任務很多&#xff0c;二是一旦Xshell頁面關閉Flume任務就會停止&#xff0c;這樣非常不…

案例研究|DataEase助力眾陶聯應對產業鏈數據可視化挑戰

佛山眾陶聯供應鏈服務有限公司&#xff08;以下簡稱為“眾陶聯”&#xff09;成立于2016年&#xff0c;是由34家陶瓷企業共同創辦的建陶行業工業互聯網平臺&#xff0c;股東產值占整個行業的22.5%。眾陶聯以數據賦能為核心&#xff0c;積極探索新的交易和服務模式&#xff0c;構…

ant-design-vue如何限制圖片上傳的尺寸?

handleBeforeUpload(file, fileList) {// fileList 只包含了當次上傳的文件列表&#xff0c;不包含已上傳的文件列表// 所以長度要加上已上傳的文件列表的長度const isLimit this.fileList.length fileList.length > this.limit;const indexOfFile fileList.findIndex(it…

C++ STL 之容器 vector 常見用法

一. 什么是vector vector為“變長數組”&#xff0c;即長度根據需要而自動改變的數組。 頭文件&#xff1a; #include <vector>using namespace std;單獨定義一個vector&#xff1a;vector<typename> name&#xff0c;相當于一維數組 name[SIZE] &#xff0c;其長…

mac-docker-php容器連接mac中的pgsql數據庫失敗以及出現table_msg存錯誤時的解決方法

以php中的thinkphp 5.1為例&#xff0c;php容器連接mac中的pgsql數據庫失敗時&#xff0c;出現如下錯誤 [7] PDOException in Connection.php line 528 SQLSTATE[08006] [7] could not connect to server: Connection refused Is the server running on host "localhost&…

Git 配置處理客戶端無法正常訪問到 github 原網站時,npm 下載依賴包失敗的問題

Git 配置處理客戶端無法正常訪問到 github 原網站時&#xff0c;npm 下載依賴包失敗的問題 使用 github 的鏡像網站地址或類似的替代產品地址&#xff0c;代替到 npm 拉取依賴包的 git 地址本地Git配置 例如&#xff1a;執行一下命令&#xff0c;則是以https://kgithub.com 替…

requests庫/urllib3庫返回WEB響應內容的處理差異

requests庫是一個廣泛使用的HTTP庫&#xff0c;用于發送HTTP請求和處理響應。 以下是requests庫中一些主要類和方法的詳細介紹&#xff1a;requests庫主要類和方法 類:requests.models.Response: status_code: 響應狀態碼。text: 以Unicode形式返回響應內容。content: 以字節形…

MySQL的主從同步原理

MySQL的主從同步&#xff08;也稱為復制&#xff09;是一種數據同步技術&#xff0c;用于將一個MySQL服務器&#xff08;主服務器&#xff09;上的數據和變更實時復制到另一個或多個MySQL服務器&#xff08;從服務器&#xff09;。這項技術支持數據備份、讀寫分離、故障恢復等多…

帝國cms7.5仿非小號區塊鏈門戶資訊網站源碼 帶手機版

帝國cms7.5仿非小號區塊鏈門戶資訊網站源碼 帶手機版 帶自動采集 開發環境&#xff1a;帝國cms 7.5 安裝環境&#xff1a;phpmysql 包含火車頭采集規則和模塊&#xff0c;采集目標站非小號官網。 專業的數字貨幣大數據平臺模板&#xff0c;采用帝國cms7.5內核仿制&#xff0…

LeetCode_22_中等_括號生成

文章目錄 1. 題目2. 思路及代碼實現&#xff08;Python&#xff09;2.1 暴力法2.2 回溯法 1. 題目 數字 n n n 代表生成括號的對數&#xff0c;請你設計一個函數&#xff0c;用于能夠生成所有可能的并且 有效的 括號組合。 示例 1&#xff1a; 輸入&#xff1a; n 3 n 3 …

Ai-WB2-32S在window下使用vs 和 msys2編譯以及燒錄

文章目錄 前言一、使用前準備第一步 安裝vscode第二步 安裝msys2 二、使用步驟1.打開MSYS2 MINGW64&#xff08;1&#xff09;在開始欄中找到MSYS2 MINGW64并打開&#xff08;2&#xff09;安裝git&#xff08;3&#xff09;安裝make&#xff08;4&#xff09;安裝好之后的文件…

前端面試練習24.3.1

一.進程和線程的區別 進程&#xff1a;是程序的一次執行過程,擁有獨立的內存空間 線程&#xff1a;是進程中的一個執行單元,共享所屬進程的內存空間和系統資源 進程&#xff08;Process&#xff09;和線程&#xff08;Thread&#xff09;是操作系統中的重要概念&#xff0c;它…