CSS border margin table list
CSS border margin table list
background-clip: padding-box/border-box/content-box
background-clip property をテスト。ドット \dpx dotted black
The background extends to the edge of content box.
dotted border
dashed border
solid border
double border
groove border
ridge border
inset border
outset border
none
hidden border
dotted dashed solid double border
border-style: groove; border-width: medium;
solid border-color: red(top) breen(right) pink(bottom) blue(left)
border left green 20px, background-color lightblue
border: 5px solid coral;/border-style shorthand property/border-width border-style(required) border-color
border-left: 10px solid red;
shorthand property for border-left-width, border-left-style, border-left-color.
border-top: thin groove tomato; box-sizing: 60%
normal border
border-radius: 4px;
bjorder-radius: 12px;
border-radius: 18px;
===========================================
change the 3 border property exercise:
border-top-style: 4px dotted red;/ testing failed.
border-top-style: dotted; border-top-width: 4px; border-top-color: red; /This is CORRECT!.
============================================
w3schoolのmargin,paddingの章は styleのbackground-color: lightblue; は自分で消したほうが理解出来る。
最初はlightblueの背景に、border: 1px solid black; な黒線が描かれていて理解不能だったが、background-colorを消すとdiv や p に書かれている文章が読めるので、上から何ピクセル左からどれだけの余幅を取っているのかが分かる。
style="width:480px;height:300px;" のようにstyleで指定
images tutorials
This is margin test. class="margin: 25px 50px 75px;"
This is also margin test. style="margin: 100px 150px 50px 250px;" top right bottom left; that is the order.
Also another one. border: 1px solid black; margin: 50px 300px;
This time; style="border: 1px solid black; margin: 10px 10px 10px 400px;"
style="margin: 35px 70px 50px; background-color: lightgreen"
35px for top
70px for left and right
50px for bottom
style="border-left: 25px solid tomato; background-color: lightgrey; margin: 10px 400px 10px 20px;"
You can set the margin property to auto to horizontally center the element within its container. The element will then take up the specified width, and the remaining space will be split equally between the left and right margins:
style="width:350px; margin: auto; background-color: lightgrey; border: 5px groove coral;"
div id="inheritmargin" Test
div style="background-color: #f9e2d2;"Chocolate: lightness 80~90% Color Picker of Chocolate
Using inherit value
using div and #inheritmargin {
background-color: hsl(0, 100%, 75%, 20%);
margin-left: 140px;
margin-right:50px;
}
}
p.margin {margin: inherit;}
inherted parent element
p.margin {margin: inherit;} /style="border: 2px dotted Olive;"
NOT inherted parent element
p.margin {margin: inherit;} style="border: 2px dotted Olive;" without div id="inheritmargin"
div id="inherimargin" Test is done.
margin collapse
Top and bottom margins of elements are sometimes collapsed into the one which equal to the largest of the two margins. Only top and bottom. Left and right margins have not this attribute.
style="margin: 0 0 80px 0;"
style="margin: 50px 0 0 0; "
above headlines have defferent margins. h2 element of bottom margin is 80px, h3 element fo top margin is 50px. The vertical margin between h2 and h3 should have 130px(80px + 50px). Because of margin collapse, the actual margin of the two is 80px.
<code> for computer
<var> for variable valeu in mathematics
Padding
top, right, bottom, left
style="border:1px solid black; style="border:1px solid black; padding: 25px 50px 75px"
style="border: 1px solid black; padding: 50px 50px 20px 100px;"
style="border: 1px solid black; padding: 20px 100px 20px 20px;"
style="padding: 25px 200px; "
This is width 300px background-color: tomato;
The width of this div 400px, even though it is defined as 300px in the css.style="width: 300px; padding: 25px; background-color: lightblue;"
box-sizing: border-box; /To keep the width of element, it's not increase the width. /style="float: right; width: 500px; border: 2px solid green; background-color: violet;"
style="width: 300px; padding: 25px; box-sizing:border-box; background-color: violet; "
Padding
Content
Outline-offset property
15px outline-offset/
margin: 25px; border: 1px dashed black; outline: 2px solid red; outline-offset: 15px;
style="width: 400px; margin: auto; border: 1px dashed black; outline: 2px solid red; outline-offset: 15px;"
text-shadow: horizontal vertical color;
font
text
-align
-shadow
-transform
-indent
-decoration
HTML Lists tutorial
ellipsis 省略(可算名詞)/ 省略記号(不可算名詞)
font property shorthand
font-style font-variant font-weight font-size/line-height font-family
p {font-style: italic;
font-size: 20px;
font-family: Verdana;
}
p { font: italic 20px Verdana:}
they'll be the same result.
list CSS
CSS links/a:link visited hover active
CSS links/a:link { color: green; }
p{list-style-type: circle/square/upper-roman/lower-alpha; }
p {list-style-image: url('some.url/.jpg') ;}
list item markers(bullet points)'s position
list-style-position: outside/inside;
list-style-position: outside(default)
- Coffee
- Tea
- Coca Cola - A carbonated soft drink produced by The Coca-Cola Company.
list-style-position: inside
to remove list of bullet points, margin, and padding
list-style-type: none; margin: 0; padding: 0;
shorthand CSS list-style property
ul { list-style: square inside url('something.gif')
in the tutorial change padding value, add "list-style-position: inside;" ,try "list-style-type: none;"
saved user code some values added and changede.
table CSS tutorial CSSは上から順に。下に記した値のほうが優先される。
#customer th {paddig:12px 0; としたことでth の文字がズレた。
ul style="border-left: 8px solid red; background-color: #f1f1f1; list-style-type: none; padding: 30px 10px;"
li { padding: 30px(vertical) 10px(horizantal); }
examples of list-style-type : cjk-ideographic(漢数字)/ hiragana(ひらがな) / katakana(カタカナ) / katakana-iroha(いろはにほへと) /etc...
first-child, last-child, nth-child
nth-child(2) { border-bottom: none; color: red; }
first-child {color: violet; width: 50%; }
last-child { color: green; }
- border: 1px solid black; padding: 6px 12px; color: violet; width: 50%;
- cat/ border-bottom: none; color: red;
- border: 1px solid black; padding: 6px 12px; width: 30%;
- border: 1px solid black; padding: 6px 12px; width: 30%;
- border: 1px solid black; padding: 6px 12px; width: 30%;
- puppy
developer.mozilla.org last-child, nth-child()
途中でnth-child()が出てきて調べたら、誘惑多いなぁ理解が追いつかない情報量(´・ω・`)
Table CSS
th horizantal alignment(text-align) of default is center. to change that, specfy the text-align left/right.
td horizantal alignment of defalt is left.
th and td vertical alignment of defalt is middle. to change that, specfy the text-align tpp/bottom/middle.
border-bottom: 1px solid black; to add the bottom lines(horizantal dividers) th and td.
nth-child(odd/even) { backgroundcolor: coral; } to add backbround color odd/even table rows.
<div style="overflow-x:auto"> Responsive table: additting the horizantal scroll bar.
caption-side: top(default)/bottom
<table style="border-collapse: collapse;">
<caption style="caption-side: bottom;"><span class="red">write caption here</span></caption>
<tr style="background-color: #4CAF50; color: white;">
<th style="text-align: left; padding: 8px;">head1</th>
<th style="text-align: left; padding: 8px;">head2</th>
<th style="text-align: left; padding: 8px;">head3</th>
</tr>
<tr style="background-color: #f2f2f2">
<td style="text-align: left; padding: 8px;">data1</td>
<td style="text-align: left; padding: 8px;">data2</td>
<td style="text-align: left; padding: 8px;">data3</td>
</tr>
<tr>
<td style="text-align: left; padding: 8px;">data4</td>
<td style="text-align: left; padding: 8px;">data5</td>
<td style="text-align: left; padding: 8px;">data6</td>
</tr>
<tr style="background-color: #f2f2f2">
<td style="text-align: left; padding: 8px;">data7</td>
<td style="text-align: left; padding: 8px;">data8</td>
<td style="text-align: left; padding: 8px;">data9</td>
</tr>
</table>
table,th,td {
border:1px solid black;
border-collapse:collapse;
text-align: left;
}がstyleに書いてあった。のを忘れてた。
table,th,tdに "padding: 8px; "更に
tr:nth-child(even) {background-color:#f2f2f2; }
を書き加え
write caption here
head1 |
head2 |
head3 |
data1 |
data2 |
data3 |
data4 |
data5 |
data6 |
data7 |
data8 |
data9 |
div style="width: 35%; overflow-x: auto;" で、overflow-x: autoのテスト
CSS(style=""では無い方)にtable,th,tdに "padding: 8px; "を加え見やすくなる。
食事時間 |
食べたもの |
食べたもの |
食べたもの |
食べたもの |
食べたもの |
食べたもの |
食べたもの |
食べたもの |
食べたもの |
食べたもの |
食べたもの |
昼食 |
キツネうどん |
キツネうどん |
キツネうどん |
キツネうどん |
キツネうどん |
キツネうどん |
キツネうどん |
キツネうどん |
キツネうどん |
キツネうどん |
キツネうどん |
おやつ |
ポップコーン |
ポップコーン |
ポップコーン |
ポップコーン |
ポップコーン |
ポップコーン |
ポップコーン |
ポップコーン |
ポップコーン |
ポップコーン |
ポップコーン |
夜食 |
ビール・ピザ |
ビール・ピザ |
ビール・ピザ |
ビール・ピザ |
ビール・ピザ |
ビール・ピザ |
ビール・ピザ |
ビール・ピザ |
ビール・ピザ |
ビール・ピザ |
ビール・ピザ |
コメント
コメントを投稿