[재미] HTML을 이용한 잡실험 1

Posted by Arimika
2015. 6. 13. 11:54 웹 디자인/HTML

드래그를 하면 색깔이 바뀌도록 하는 방법


<.!DOCTYPE html>

<.html>

<.head>

<.style>

.h6::selection { background: black; color: red; }                <-- 스타일시스를 h6 가 드래그 되면, {배경색은 원사는색, 글자색은 원하는색}으로 만들기!

<./style>

<./head>

<.body>

<.h1> 실험중</h1>

<.h6>드래그함 해봐야지</h6>            <-- 여기에 입력된 글자는 드래그하면 내가 설정한 대로 된다. 

<./body>

<./html>


ps. 맨 앞에붙은 쩜은 다 지우기!!


실험 결과

h6::selection { background: black; color: red; }드래그함 해봐!!!

h5::selection { background: yellow; color: red; }드래그함 해봐!!!

h4::selection { background: red; color: yellow; }드래그함 해봐!!!

h3::selection { background: #FF66F6; color: #00FF34; }드래그함 해봐!!!

h2::selection { background: black; color: #0000FF; }드래그함 해봐!!!

ps. h로 설정한 이유는 p태그가 대부분 이용되기 때문에 p로하면 다른 글에도 피해가... ㅋ