Joe.wang
Joe.wang

Reputation: 11793

CSS attribute selector for class name

All. I have some trouble with the css selector in my code . Please review the below code .

Say you have the html structure like below.

<div id="currentTmpContainer" class="layoutcontainer container-fluid">
        <div class="row-fluid">
            <div class="span12">
                <ul id="sortable1" class="sortableLayoutSection">

                </ul>
            </div>
        </div>
        <div class="row-fluid">
            <div class="span12">
                <ul id="sortable3" class="sortableLayoutSection">

                </ul>
            </div>
        </div>
        <div class="row-fluid">
            <div class="span12">
                <ul id="sortable3" class="sortableLayoutSection">

                </ul>
            </div>
        </div>
    </div>

I want to select the div with the class name begin with "span". So I wrote the selector(Attribute selectors) below, but it doesn't work.

.layoutcontainer div[class^=”span”]
{
    border:1px solid red;
}

Upvotes: 1

Views: 6884

Answers (1)

Explosion Pills
Explosion Pills

Reputation: 191729

You have some weird slanty quotes going on here. Use normal ASCII quotes, "

.layoutcontainer div[class^="span"]
{
    border:1px solid red;
}

http://jsfiddle.net/ExplosionPIlls/YpmUy/ -- seems to work just fine

Upvotes: 7

Related Questions