2014-04-15 18 views
0

Hey guys i have something like this:CSS - <a href="#">

<a href="#"><span id="shorttext"><h4>V posledných dnech se událo mnoho změn, které byli velice výrazné. Proto neváhajte a podívete se i vy na to, co se vlastne zmenilo a nebo nezměnilo kdo vi... </h4></span></a> 

I just move out before span to make full block as href not just text and text become underline.

I try to fix it with something like:

h4 { 
    padding: 5px 10px 10px 10px;   /*text v slidery, opacity */ 
    font-color:FFFFFF; 
} 

a h4 { 
    padding: 5px 10px 10px 10px;   /*text v slidery, opacity */ 
    font-color:FFFFFF; 
    text-decoration: none; 
} 

a:visited h4{ 
    text-decoration:none;   
} 
a:active h4{ 
    text-decoration:none;   
} 
a:link h4{ 
    text-decoration:none;   
} 

But it didnt really help, and advise?

Thanks for reading my post :)

+1

귀하의 HTML이 유효하지 사용해야합니다. 범위 안에 제목을 사용할 수 없습니다. [validator] (http://validator.w3.org)를 사용하십시오. – Quentin

+0

{text-decoration : none;}? – Fuzzyma

답변

4

The underline is on the anchor, not the heading.

Remove it from the anchor.

a { 
    text-decoration: none; 
} 
3

It would make much more sense to clear this up and give the a a clear class which indicates it's semantical meaning inside the HTML:

<a href="#" class="whatever-fits"></a> 

Then add style:

a.whatever-fits { 
    text-decoration: none; 
} 

Additional remarks:

Your nesting of a , h4 and span are invalid HTML의 밑줄을 제거하십시오.

font-color:FFFFFF;

2 실수 있습니다, 당신은 단순히 color

  • 진수 색상이 필요로 사용하는 텍스트의 색상 스타일을, font-color라는 어떤 속성이 존재하지 않는

    1. #을 선도하고, 예를 들어, #FFFFFF

  • +0

    슬프게도 중첩 주석에 대한 참조로 사용하는 질문의 맨 위로 대답은 HTML 5의 변경 사항 (앵커 내부에 비 대화식 요소가 나타날 수 있음)을 고려하지 않습니다. – Quentin

    +0

    @Quentin 귀하의 의견에 감사드립니다; 불행히도 나는 자세하게 연구하지 않았다. 스팬 내에 표제가 허용되지 않으므로 (위 코드를 w3 유효성 검사기로 복사) HTML이 여전히 유효하지 않습니다. – DanFromGermany

    1
    h4 { 
         padding: 5px 10px 10px 10px;   /*text v slidery, opacity */ 
         color:#fff; } 
    
        a h4 { 
         padding: 5px 10px 10px 10px;   /*text v slidery, opacity */ 
         color:#fff; 
         text-decoration: none; } 
    
        a:visited h4{ 
         text-decoration:none;   } 
    a:active h4{ 
         text-decoration:none;   } 
    a:link h4{ 
         text-decoration:none;   } 
    
    0

    당신은

    a { 
        text-decoration: none; 
    }