2つの proc を合成して1つの proc にする
# 2つの proc を合成して1つの proc にする def foo(arg1, arg2) Proc.new do arg1.call arg2.call end end p1 = Proc.new { p 123} p2 = Proc.new { p 456} res = foo( p1, p2 ) res.call # => 123\n456
cssのパディングとマージン
パディングとマージンどっちがどっちかよく忘れるのでメモしておく。
コード
<html> <head> <style type="text/css"> div { padding : 10px; /* 要素とボーダーラインのあいだの距離 */ border : 5px solid maroon; /* ボーダーラインの幅 */ margin : 10px; /* ボーダーラインと画面の端の距離 */ background-color : lightgreen; } </style> </head> <body> <div class="hoge"> hoge </div> </body> </html>
ちなみにcssでは //
をコメントに使えないので /* */
を使う必要がある。