-4
<div class='cluster' id='12' 'style='width:350px;min-height:150px;border:4px
solid #339966;'>
    <div class='image' style='width:150px;height:150px;border:2px solid
black;float:left;margin-bottom:10px;margin-left:10px'>
    <img id='image1' src='server/php/files/image.jpg' style='width:140px;height:140px;float:left;'>
    <img id='image22' src='server/php/files/image.jpg' style='width:140px;height:140px;float:left;'>
    <img id='image45' src='server/php/files/image.jpg' style='width:140px;height:140px;float:left;'>
</div>
</div>

以这种格式显示图像

帮我

4

2 回答 2

2

try like this

$('#img120').css({ 'display': ' inline-block', 'padding-left': '177px' });

if starts with img and the number changes try like this

$('img[id^="img"]').css({ 'display': ' inline-block', 'padding-left': '177px' });

if you want ends with 120

$("img[id$='120']").css({ 'display': ' inline-block', 'padding-left': '177px' });
于 2012-12-20T07:49:18.820 回答
1
  1. Your question is totally incomplete.
  2. Your html tag ids are different as compared to your question.

As for as I have understood your question, You want to ask that how you can apply some css to inner elements wrapped in tags. If I take your question, that there is a div having class cluster and in that div you have images having id="120" like this

 <div class="cluster">
     <img src="some src" id="120" />
     <img src="some src" id="120" />
     <img src="some src" id="120" />  
</div>

Then you can write css like

<style>
.cluster #120 {
 /* Your css properties */
 width:140px;
 height:140px;
 float:left;

}
</style>

If you want to put a style to all images in div class cluster, you can do it like this

 <style>
.cluster image {
 /* Your css properties */
 width:140px;
 height:140px;
 float:left;

}
</style>

By doing this you will not have to give style property to each image.

于 2012-12-20T07:50:29.077 回答