English 中文(简体)
将有条件的 CSS 选择器应用到 arribute 母体
原标题:Applying conditional CSS selectors to magento atrribute

我试图做到以下几点:

我为我的产品 & amp 设置了一些 Magento 属性; 我想在名为“ 颜色” 的属性旁边显示一个图标, 并在此图标/ 图像上附加一个 Alt 标记。 我的主题将每个属性都设置为 dt 标记, & amp; 因此, 我试图应用的 cs 如下 :

dt[foo^="Color:"]{background: url(http://xyz.com/skin/frontend/default/default/images/warning.png) no-repeat 100% 0%;}

and here is the markup: <div class="white-box-inner"> <dl class="attribute-list clearfix">``<dt class="first">Size:</dt>``<dd class="first">21</dd> <dt>Manufacturer:</dt>``<dd>Hat Designs</dd>``<dt>Color:</dt> <dd>Red</dd>``<dt>Fabric</dt> <dd>Felt</dd> </dl> </div>

  • This however does not display the icon I d like to appear.
  • I m also not sure how to have an alt tag associated with this icon either via css. I d rather not mess with the template files. Any help is appreciated.

Thanks. -TM

最佳回答

从标记上看,它似乎正在试图根据内容选择元素。 属性选择器仅根据属性选择; 它们不根据内容选择 。

本来会有一个 < code> : contains () 伪类, 但从规格中删除了, 所以您不能再使用 CSS 选择器这样做 。

jQuery 执行 :contains () ,这样你就可以简单地使用 jQuery 添加一个类和样式 。

此外,您无法将alt 文本或工具提示与 CSS 中的背景图像联系起来。 您需要通过 JavaScript 路径才能做到这一点 。

问题回答

暂无回答




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

Drop down background url in Safari Issue

selectBox.selectCSS { background: url(/Images/replacementSelectBackground.png) top left no-repeat height:auto; } I have an issue in Safari only where the image is not rendering on top ...

CSS specific for Safari

How do you target specifically safari in css with styles?

Aligning textarea in a form

Ive used the following css code to align my form elements: form { position:relative; } form input { position:absolute; left:11em; } However, the textarea element is not aligned correctly with the ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

CSS problem with page footer

I have defined my page footer in the css file as: #footer { position: absolute; height: 50px; text-align: center; background: #66CCCC; bottom: 0px; left: 0px; width: 100%; height: ...

热门标签