How do I target a div without a class or id but with all these specific style-attributes

Posted by Ben on Stack Overflow See other posts from Stack Overflow or by Ben
Published on 2014-08-20T09:51:48Z Indexed on 2014/08/20 10:20 UTC
Read the original article Hit count: 283

Filed under:
|
|
|

I'm restyling a certain page where I don't have access to all the source-HTML. So I'm left over with some hard to target elements within a page I need removed.

For example the page is swamped with <div style="float: left; width: 10.25px; height: 284px;"></div>.

To get rid of them I tried this in CSS:

div[style="float: left; width: 10.25px; height: 284px;"] { 
  display:none !important;
}

I'd like to fix this using CSS, because the the HTML that needs to be removed is updated using ajax.

How do I target a div without a class or id but with all these specific style-attributes?

Some more of the source-code (took a while to organize the parsed source):

<div>                       
    <span class="Block BigPhotoList_Block">
        <span class="Photo BigPhotoList_Photo" style="height: 200px">
            <a href="/Webwinkel-Product-83760187/Le-Coq-Sportif-Angers-Low.html.html">
                <span style="background-image:url(http://61955.static.securearea.eu/Files/2/61000/61955/ProductPhotos/MaxContent/144036303.jpg);" class="Canvas BigPhotoList_Canvas" title="Le-Coq-Sportif-Angers-Low"></span>
            </a>
        </span>
        <span class="Title BigPhotoList_Title">
            <a href="/Webwinkel-Product-83760187/Le-Coq-Sportif-Angers-Low.html.html">
                Le Coq Sportif Angers Low
                </a>
        </span>     
        <span class="Price BigPhotoList_Price" style="font-size: 120%;">
            € 89,95
        </span>
    </span>

    <div style="float: left; width: 10.25px; height: 284px; border-right: 1px dashed #A0A0A0;" class="BigPhotoList_Stippel"></div>
    <div style="float: left; width: 10.25px; height: 284px;"></div>

    <span class="Block BigPhotoList_Block">
        <span class="Photo BigPhotoList_Photo" style="height: 200px">
            <a href="/Webwinkel-Product-83760185/Le-Coq-Sportif-Auveurne-Low.html">
                <span style="background-image:url(http://61955.static.securearea.eu/Files/2/61000/61955/ProductPhotos/MaxContent/144036301.jpg);" class="Canvas BigPhotoList_Canvas" title="Le-Coq-Sportif-Auveurne-Low"></span>
            </a>
        </span>
        <span class="Title BigPhotoList_Title">
            <a href="/Webwinkel-Product-83760185/Le-Coq-Sportif-Auveurne-Low.html">
                Le Coq Sportif Auveurne Low
            </a>
        </span>
        <span class="Price BigPhotoList_Price" style="font-size: 120%;">
            € 79,95
        </span>
    </span>

    <div style="float: left; width: 10.25px; height: 284px; border-right: 1px dashed #A0A0A0;" class="BigPhotoList_Stippel"></div>
    <div style="float: left; width: 10.25px; height: 284px;"></div>

    <span class="Block BigPhotoList_Block">
        <span class="Photo BigPhotoList_Photo" style="height: 200px">
            <a href="/Webwinkel-Product-83760191/Le-Coq-Sportif-Bordeaux-Low.html">
                <span style="background-image:url(http://61955.static.securearea.eu/Files/2/61000/61955/ProductPhotos/MaxContent/144036307.jpg);" class="Canvas BigPhotoList_Canvas" title="Le-Coq-Sportif-Bordeaux-Low"></span>
            </a>
        </span>
        <span class="Title BigPhotoList_Title">
            <a href="/Webwinkel-Product-83760191/Le-Coq-Sportif-Bordeaux-Low.html">
                Le Coq Sportif Bordeaux Low
            </a>
        </span>     
        <span class="Price BigPhotoList_Price" style="font-size: 120%;">
            € 99,95
        </span>
    </span>

    <span class="Block BigPhotoList_Block">
        <span class="Photo BigPhotoList_Photo" style="height: 200px">
            <a href="/Webwinkel-Product-83760181/Le-Coq-Sportif-Cannet-Low.html">
                <span style="background-image:url(http://61955.static.securearea.eu/Files/2/61000/61955/ProductPhotos/MaxContent/144036297.jpg);" class="Canvas BigPhotoList_Canvas" title="Le-Coq-Sportif-Cannet-Low"></span>
            </a>
        </span>
        <span class="Title BigPhotoList_Title">
            <a href="/Webwinkel-Product-83760181/Le-Coq-Sportif-Cannet-Low.html">
                Le Coq Sportif Cannet Low
            </a>
        </span>
        <span class="Discount BigPhotoList_Discount" style="font-size: 120%;">
            € 99,95
        </span>     
        <span class="Price BigPhotoList_Price" style="font-size: 120%;">
            € 94,95
        </span>
    </span>

    <div style="float: left; width: 10.25px; height: 284px; border-right: 1px dashed #A0A0A0;" class="BigPhotoList_Stippel"></div>
    <div style="float: left; width: 10.25px; height: 284px;"></div>

    <span class="Block BigPhotoList_Block">
        <span class="Photo BigPhotoList_Photo" style="height: 200px">
            <a href="/Webwinkel-Product-83760183/Le-Coq-Sportif-Rodez-Low.html">
                <span style="background-image:url(http://61955.static.securearea.eu/Files/2/61000/61955/ProductPhotos/MaxContent/144036299.jpg);" class="Canvas BigPhotoList_Canvas" title="Le-Coq-Sportif-Rodez-Low"></span>
            </a>
        </span>
        <span class="Title BigPhotoList_Title">
            <a href="/Webwinkel-Product-83760183/Le-Coq-Sportif-Rodez-Low.html">
                Le Coq Sportif Rodez Low
            </a>
        </span>
        <span class="Price BigPhotoList_Price" style="font-size: 120%;">
            € 99,95
        </span>
    </span>

    <div style="float: left; width: 10.25px; height: 284px; border-right: 1px dashed #A0A0A0;" class="BigPhotoList_Stippel"></div>
    <div style="float: left; width: 10.25px; height: 284px;"></div>

    <span class="Block BigPhotoList_Block">
        <span class="Photo BigPhotoList_Photo" style="height: 200px">
            <a href="/Webwinkel-Product-83760189/Le-Coq-Sportif-Sedan-Low.html">
                <span style="background-image:url(http://61955.static.securearea.eu/Files/2/61000/61955/ProductPhotos/MaxContent/144036305.jpg);" class="Canvas BigPhotoList_Canvas" title="Le-Coq-Sportif-Sedan-Low"></span>
            </a>
        </span>
        <span class="Title BigPhotoList_Title">
            <a href="/Webwinkel-Product-83760189/Le-Coq-Sportif-Sedan-Low.html">
                Le Coq Sportif Sedan Low
            </a>
        </span>
        <span class="Discount BigPhotoList_Discount" style="font-size: 120%;">
            € 109,95
        </span>     
        <span class="Price BigPhotoList_Price" style="font-size: 120%;">
            € 99,95
        </span>
    </span>
</div>

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about html