Skip to content

Instantly share code, notes, and snippets.

@motsu0
motsu0 / fraction.css
Last active January 15, 2019 02:09
write fraction with only CSS
.fraction{
display: inline-block;
vertical-align: middle;
text-align: center;
}
.fraction_n,.fraction_d{
display: block;
}
.fraction_n{
border-bottom: 1px solid #333;
@motsu0
motsu0 / radio_button_01.css
Last active February 26, 2023 07:52
css radio button design
.radio-box1{
display: flex;
}
.radio1{
display: none;
}
.label-radio1{
padding: 2px 8px;
border: 1px solid #3498DB;
color: #3498DB;
@motsu0
motsu0 / 01input_range_css
Last active January 16, 2019 08:41
input range
#demobox{
display: flex;
justify-content: center;
align-items: center;
position: relative;
width: 100%;
height: 200px;
border: 1px solid #ddd;
}
#demochild{
<!-- headタグ内 / in <head> -->
<link rel="path/to/simple-img-modal.css">
<!-- bodyタグの終了直前 / before </body> -->
<script src="path/to/simple-img-modal.js"></script>
<script>
const modal = new simpleImgModal();
</script>
<!-- 画像を置きたい場所 / in your html -->
@motsu0
motsu0 / 01js-search-in-page.css
Last active August 24, 2023 11:55
keyword search in page
.s-highlight{
background-color:yellow;
}
.s-hide{
display: none;
}
@motsu0
motsu0 / random-true-or-false.js
Created January 29, 2020 14:42
generate ramdom bool (true or false)
const bool = Math.random()<0.5; //bool=true or bool=false
@motsu0
motsu0 / random-betweet-m-and-n.js
Created January 29, 2020 15:01
generate ramdom integer between M and N
function randomMN(m,n){
const d = Math.max(m,n)-Math.min(m,n);
return Math.floor(Math.random()*(d+1)+Math.min(m,n));
}
// randomMN(3,9) => 3~9(int)
// randomMN(-2,4) => -2~4(int)
@motsu0
motsu0 / date-obj.js
Created January 30, 2020 13:45
Date object
const date = new Date(); //現在の日時よりDateオブジェクトを生成
const yyyy = date.getFullYear(); //年
const MM = date.getMonth()+1; //月
const dd = date.getDate(); //日
const hh = date.getHours(); //時
const mm = date.getMinutes(); //分
const dow_list = ['日','月','火','水','木','金','土'];
const dow = dow_list[date.getDay()]; //曜日
<!-- 左カラム(固定幅)、右カラム(可変幅) -->
<div class="parent">
parent
<table class="sample1">
<tr>
<td class="lc">吾輩は猫である</td>
<td class="rc">吾輩は猫である。名前はまだ無い。<br>どこで生れたかとんと見当がつかぬ。何でも薄暗いじめじめした所でニャーニャー泣いていた事だけは記憶している。</td>
</tr>
<tr>
<td class="lc">坊っちゃん</td>
<!-- 左カラム(固定幅)、右カラム(可変幅) -->
<div class="parent">
parent
<div class="sample2">
<div class="lc">吾輩は猫である</div>
<div class="rc">吾輩は猫である。名前はまだ無い。<br>どこで生れたかとんと見当がつかぬ。何でも薄暗いじめじめした所でニャーニャー泣いていた事だけは記憶している。</div>
<div class="lc">坊っちゃん</div>
<div class="rc">親譲りの無鉄砲で小供の時から損ばかりしている。小学校に居る時分学校の二階から飛び降りて一週間ほど腰を抜かした事がある。</div>
<div class="clear"></div>
</div>