开发者

CSS Casing Ignored

开发者 https://www.devze.com 2023-03-04 00:06 出处:网络
For some reason, the featured articles in the right column are ignoring the开发者_StackOverflow中文版 \'#elementtext\' and \'#elementtext:hover\' attributes. Only \'p.element\' and \'img.element\' are

For some reason, the featured articles in the right column are ignoring the开发者_StackOverflow中文版 '#elementtext' and '#elementtext:hover' attributes. Only 'p.element' and 'img.element' are showing.

Any ideas?

Thanks - Tara

Bonus: I'm also trying to get the 'p.element' text to float centrally (vertically and horizontally - while being left aligned) in the '#elementtext' boxes.

#elementtext {
        height: 90px;
        width: 150px;
    margin-left: 1px;
    background: #c3c3c3;
    padding: 0px 10px 0px 5px;
}
p.element {
        height: 85px;
        width: 145px;
    padding: 2.5px 2.5px 2.5px 2.5px;
}
#elementtext:hover{
    background:#ff9999;
    cursor:pointer;
}


span is an inline element you cannot put tags in it add display:block to your #elementtext

like this

#elementtext {
display:block;
height: 90px;
width: 150px;
margin-left: 1px;
background: #c3c3c3;
padding: 0px 10px 0px 5px;
}

edit i think you have class="elementtext" so you put . infront of it not #

.elementtext {
display:block;
height: 90px;
width: 150px;
margin-left: 1px;
background: #c3c3c3;
padding: 0px 10px 0px 5px;
}


By the sounds of it, you have multiple instances of elementtext. If that is the case then these should be classes and not ids. A css id should be unique throughout the page.

Try the following HTML:

<span class="elementtext">Test</span>

And the css:

 .elementtext {
    height: 90px;
    width: 150px;
    margin-left: 1px;
    background: #c3c3c3;
    padding: 0px 10px 0px 5px;
}
p.element {
    height: 85px;
    width: 145px;
    padding: 2.5px 2.5px 2.5px 2.5px;
}
.elementtext:hover{
    background:#ff9999;
    cursor:pointer;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消