如何在CSS中选择纯HTML文本? [英] how to select plain HTML-text in CSS?
问题描述
有没有人知道如何在CSS中选择纯HTML文本?
我有以下结构:
< div id =A>
< p class =caption> caption 1< / p>
< div class =tabs>
< div class ='moving_bg'>< / div>
< p class =text tab_item>内容< / p>
< p class =text tab_item>内容< / p>
< p class =text tab_item>内容< / p>
< p class =text tab_item>内容< / p>
< p class =text tab_item>内容< / p>
< p class =text tab_item>内容< / p>
caption2
< p class =standardtext tab_item> content< / p>
< p class =standardtext tab_item>内容< / p>
< p class =standardtext tab_item>内容< / p>
< / div>
如何在CSS中选择 caption2
?
一旦我为它分配了一个类或一个p标签,它会破坏我使用的tab-plugin的结构。
编辑:
我使用此插件,并将其更改为:
var TabbedContent = {
init:function(){
$(tab_item)。mouseover(function(){
var background = $(this).parent (.moving_bg);
$(背景).stop()。animate({
top:$(this).position()['top']
}; {
duration:300
});
TabbedContent.slideContent($(this));
}
},
slideContent:function(obj){
var margin = $(obj).parent()。parent ().find(。slide_content)。width();
margin = margin *($(obj).prevAll()。size() - 1);
margin = margin * -1;
$(obj).parent()。parent()。parent()。parent()。find(。tabslider)。stop()。animate({
marginLeft: margin +px
},{
duration:300
});
}
}
$(document).ready(function(){
TabbedContent.init();
});
您只能选择元素和伪元素/类。 / p>
您可能可以使用样式 .tabs
,然后覆盖 .tabs> *
。
一旦我为它分配了一个类或一个p标签,
然后编辑插件。
Does anyone of you know how to select plain HTML-text in CSS?
I have the following structure:
<div id="A">
<p class="caption"> caption1 </p>
<div class="tabs">
<div class='moving_bg'></div>
<p class="text tab_item"> content</p>
<p class="text tab_item"> content</p>
<p class="text tab_item"> content</p>
<p class="text tab_item"> content</p>
<p class="text tab_item"> content</p>
<p class="text tab_item"> content</p>
caption2
<p class="standardtext tab_item">content</p>
<p class="standardtext tab_item"> content</p>
<p class="standardtext tab_item"> content</p>
</div>
How do I select the caption2
in CSS?
As soon as I assign a class or a p-tag to it, it breakes the structure of the tab-plugin I'm using.
Edit: I used this plugin and changed it a little bit into:
var TabbedContent = {
init: function() {
$(".tab_item").mouseover(function() {
var background = $(this).parent().find(".moving_bg");
$(background).stop().animate({
top: $(this).position()['top']
}, {
duration: 300
});
TabbedContent.slideContent($(this));
});
},
slideContent: function(obj) {
var margin = $(obj).parent().parent().parent().parent().find(".slide_content").width();
margin = margin * ($(obj).prevAll().size() - 1);
margin = margin * -1;
$(obj).parent().parent().parent().parent().find(".tabslider").stop().animate({
marginLeft: margin + "px"
}, {
duration: 300
});
}
}
$(document).ready(function() {
TabbedContent.init();
});
You can't. You can only select elements and pseudo-elements/classes.
You might be able to get away with styling .tabs
and then overriding the styles on .tabs > *
.
As soon as I assign a class or a p-tag to it, it breakes the structure of the tab-plugin I'm using.
Edit the plugin then.
这篇关于如何在CSS中选择纯HTML文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!