忍者ブログ

からすまる日誌

2020031101 復習 flex

×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

2020031101 復習 flex

自分好みのエディターをさがすのが大事
ビジュアル(デザイン)に関しても1冊読んでおくといい。
 
時間はサーバ側の時間で設定したほうがいい。ユーザは自分で時間を変えちゃうかも。
予約システムでこれをやられるとまずい。
 
 

 
flex
画像と文字を横並びにするのに使ったりする
 
  <section>
   <div class="flex">
    <p>aaa</p>
    <div>
     <img src="" alt="">
    </div>
   </div>
     <div class="flex">
    <p>aaa</p>
    <div>
     <img src="" alt="">
    </div>
   </div>
  </section>
nth childをつかうときは
そのうえをなにかで包む
そうして初めて「要素の何番目」になるので。
ここでも
<section>
でくくってある。
 
--->test2.php
 
<!DOCTYPE html>
<html lang="ja">
 <head>
  <meta charset="UTF-8">
  <title>flex</title>
  <link rel="stylesheet" href="test1.css">
 </head>
 <body>
  <section>
  <?php for($i=0;$i<4;$i++): ?>
   <div class="flex">
    <p>aaa<?php echo $i ?></p>
    <div>
     <img src="fish.png" alt="">
    </div>
   </div>
   <?php endfor; ?>
  </section>
  
 </body>
</html>
 
--->test1.css
 
.section{
 width:80%;
 max-width:800px;
}
.flex{
 background-color:#ccf;
 display:flex;
 flex-direction:column;
 align-items:center;
}
.flex:nth-child(2n){
 flex-direction:row-reverse;
 align-items:center;
}
@media screen and (min-width:768px) and ( max-width:1024px) {
 .flex{
  background-color:#fcc;
  flex-direction:row;
  align-items:center;
 }
}
 
なにかどっかまちがえてる
あとでさがす
 
 
PR

コメント

ブログ内検索

カレンダー

03 2025/04 05
S M T W T F S
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