CSS/Cookbook

【CSS/Common】<li>태그에서 bullet표시 없애기

1Q74 2023. 3. 1. 22:28

다음 속성을 이용하시면 됩니다.

list-style-type: none;

1. Example

[Click Me]버튼을 클릭할 때마다 블릿표시가 토글됩니다.


[1q74.tistory.com] css/common/li/bullet-display
  • 블릿 마크가 표시됩니다


  • [HTML Code]
    [//HTML Code]

    2. Source

    더보기
    <!-- ---------------------------------------------------------
      --
      -- Author: 1q74.tistory.com
      --
      --------------------------------------------------------- -->
    <!doctype html>
    <html lang="ko">
    <head>
    <meta charset="utf-8">
    <title>[1q74.tistory.com] css/common/li/bullet-display</title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
    </head>
    <body>
    
    	<div name="_1q74-example-root">
    		<div name="_1q74-example-1">
    			<li>블릿 마크가 표시됩니다</li>
    		</div>
    
    		<div name="_1q74-example-bottom">
    			<br/>
    			<button name="btn-execute">Click Me</button>
    		</div>
    	</div>
    
    	<hr/>
    	<h5>[HTML Code]</h5>
    	<div name="_1q74-source">
    	</div>
    	<h5>[//HTML Code]</h5>
    
    <script>
    var example = $("[name='_1q74-example-1'] > li");
    var btnExecute = $("[name='btn-execute']");
    
    btnExecute.click(function() {
    	if(!example.is("[style]")) {
    		example
    			.css("list-style-type", "none")
    			.text("블릿 마크가 없어집니다");
    	} else {
    		example.removeAttr("style").text("블릿 마크가 표시됩니다");
    	}
    });
    
    // ------------------------------------------------------
    // 소스출력
    // ------------------------------------------------------
    var textSource = $("[name='_1q74-source']");
    var exampleHtml = $("[name='_1q74-example-root']").html();
    var specialCharLines = textSource.text(exampleHtml).html().split("\n");
    textSource.html(specialCharLines.join("<br/>").replaceAll("\t", "&nbsp;&nbsp;"));
    // ------------------------------------------------------
    </script>
    
    <style>
    [name|="_1q74-example"] button {
    	background: lightgray;
    	border: 5px outset;
    	min-height: 30px;
    }
    
    [name|="_1q74-example"] button:active {
    	border: 2px inset;
    	min-height: 30px;
    }
    </style>
    </body>
    </html>

    3. File

    [css][common][li]bullet-display.html
    0.00MB