戻る

buttonタグを枠なし背景なしの透過色にする
透過色ボタンに変更する処理

border: none; background-color: transparent;

border: none
枠線を非表示にします。
background-color: transparent
背景色を透過色にします。


[サンプル]
[ボタンを選択した結果]

[HTML]


[CSS]


[javascript]
copy
const b1 = document.getElementById("b1");
const b2 = document.getElementById("b2");
const b3 = document.getElementById("b3");
const b4 = document.getElementById("b4");
b1.addEventListener("click", () => 
{
	tapButton(1);
});
b2.addEventListener("click", () => 
{
	tapButton(2);
});
b3.addEventListener("click", () => 
{
	tapButton(3);
});
b4.addEventListener("click", () => 
{
	tapButton(4);
});
function tapButton(no)
{
	let text = "";
	switch(no)
	{
		case 1:
			text ="枠線なし/背景色なし";
			break;
		case 2:
			text ="枠線あり/背景色なし";
			break;
		case 3:
			text ="枠線あり/背景色あり";
			break;
		case 4:
			text ="枠線なし/背景色あり";
			break;
	}
	const lbl1 = document.getElementById("lbl1");
	lbl1.innerText = text;
}


戻る
back

Set the button tag to a transparent color with no border or background
Process to change to transparent color button

border: none; background-color: transparent;

border: none
Hide the border.
background-color: transparent
Set the background color to transparent.


[sample]
[Result of selecting the button]

[HTML]


[CSS]


[javascript]
copy
const b1 = document.getElementById("b1");
const b2 = document.getElementById("b2");
const b3 = document.getElementById("b3");
const b4 = document.getElementById("b4");
b1.addEventListener("click", () => 
{
	tapButton(1);
});
b2.addEventListener("click", () => 
{
	tapButton(2);
});
b3.addEventListener("click", () => 
{
	tapButton(3);
});
b4.addEventListener("click", () => 
{
	tapButton(4);
});
function tapButton(no)
{
	let text = "";
	switch(no)
	{
		case 1:
			text ="No border/No background color";
			break;
		case 2:
			text ="With border/No background color";
			break;
		case 3:
			text ="With border/with background color";
			break;
		case 4:
			text ="No border/with background color";
			break;
	}
	const lbl1 = document.getElementById("lbl1");
	lbl1.innerText = text;
}


back



著作権情報
ホームページおよプリ等に掲載されている情報等については、いかなる保障もいたしません。
ホームページおよびアプリ等を通じて入手したいかなる情報も複製、販売、出版または使用させたり、
または公開したりすることはできません。
当方は、ホームペーよびアプリ利用したいかなる理由によっての障害等が発生しても、
その結果ホームページおよびアプリ等を利用された本人または他の第三者が被った損害について
一切の責任を負わないものとします。