Computer >> 컴퓨터 >  >> 프로그램 작성 >> CSS

CSS의 이미지 마커용 크로스 브라우저 솔루션


모든 브라우저에서 이미지 마커를 올바르게 표시하려면 브라우저 간 솔루션이 필요합니다. 이미지 마커 뒤의 텍스트 정렬이 때때로 왜곡됩니다. 균일한 출력을 얻기 위해 배경으로 마커로 사용할 이미지를 지정하고 그에 따라 정렬합니다.

예시

다음 예는 목록 스타일을 보여줍니다 -

<!DOCTYPE html>
<html>
<head>
<style>
ul{
   list-style-type: none;
   padding: 0px;
   margin: 0px;
   font-size: 1.5em;
}
ul li{
   background-image: url("https://www.tutorialspoint.com/images/spring.png");
   background-repeat: no-repeat;
   background-position: 0px 5px;
   padding-left: 24px;
}
</style>
</head>
<body>
<h2>Tutorials</h2>
<ul>
<li>Java</li>
<li>C#</li>
<li>C</li>
<li>C++</li>
<li>Spring</li>
<li>Hibernate</li>
</ul>
</body>
</html>

출력

이것은 다음 출력을 제공합니다 -

CSS의 이미지 마커용 크로스 브라우저 솔루션

예시

<!DOCTYPE html>
<html>
<head>
<style>
ul{
   box-shadow: inset 0 0 8px orange;
   list-style-type: none;
   padding: 12px;
   padding-left: 20px;
   margin: 2px;
   font-size: 1.35em;
}
ul li{
   background-image: url("https://www.tutorialspoint.com/images/css.png");
   background-repeat: no-repeat;
   background-position: 0px 5px;
   padding-left: 40px;
   font-style: italic;
}
</style>
</head>
<body>
<p>Requirements:</p>
<ul>
<li>Tutorials</li>
<li>Interview QA</li>
<li>Quiz</li>
</ul>
</body>
</html>

출력

이것은 다음 출력을 제공합니다 -

CSS의 이미지 마커용 크로스 브라우저 솔루션