css질문

css질문

QA

css질문

본문


안녕요 <span class="hid"><font color="Red">바</font>이루</span>
<style>
.hid{margin:0 !important;padding:1px 0 !important;color:#e9e9e9 !important ;background-color:#e9e9e9 !important; cursor:pointer !important;-
ms-user-select: none;   -moz-user-select: -moz-none;  -khtml-user-select: none; -webkit-user-select: none;   user-select: none;position:relative;z-index:999}
</style>
<script>
$(function(){
    $(".hid").click(function(){
        $(this).removeClass("hid");
    });
});
</script>

 

이런식으로 되어있는 소스 코드가 있습니다.

위 코드를 보면 아래 이미지처럼 나옵니다.

 

991820168_1519386204.9002.png

 

회색부분을 겉어내면 

991820168_1519386284.1505.png

이렇게 나오는데요...

 

font-color red를 회색을 누르면 적용되어잇게 하고 싶은데...

어떻게 해야되나요??

 

퀴즈 관련 용도로 쓰려고하는데..
 

이 질문에 댓글 쓰기 :

답변 2

일단 font-color 태그는 이제 사용하지 않으니 <a> 태그로 잡으시고요<a  class="클래스1" >바</a><span class="클래스2">이루 </span> 이런 식으로  잡으셔서  클래스 1을 클릭했을 때 클래스2 hidden 된 클래스가 사라지게 하시면 될것같아요 

잘 될지 잘 모르겠습니다만, 조금 쉽게 고쳐본 소스입니다.

혹 잘 된다면 응용하시면 될 것 같습니다.

 

ex.


<span>안녕요<span class="s_red">바</span><span class="s_bg_gray">이루</span></span>
<style>
.s_red {color: red}
.s_bg_gray {background: #e9e9e9; color: #e9e9e9; cursor:pointer}
.s_bg_gray.on {background: transparent; color: #333; cursor:pointer}
</style>
<script>
$(function() {
  $('.s_bg_gray').on('click', function() {    
    $(this).toggleClass('on');
    //$(this).css({'background' : 'transparent', 'color' : '#333'});
  });
});
</script>   
답변을 작성하시기 전에 로그인 해주세요.
전체 123,643 | RSS
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT