开发者

Change image layout orientation

I am display开发者_StackOverflow中文版ing the images here..they are arranging in vertical way by generating

dynamically...But i want it in horizontal pattern...how can i do this?

 for (int i = 0; i < listOfFiles.length; i++) {
         if (listOfFiles[i].isFile()) {
          // System.out.println("File " + listOfFiles[i].getName());
                String finalImage="Images/"+listOfFiles[i].getName();
            out.print("<img src='"+finalImage+"' width='200' height='200'/>");    
             //out.println(finalImage);
         }
 }


try putting them in their own div instead:

for (...) {
  out.print("<div style=\"float:left;\">");
  out.print("<img ...");
  out.print("</div>");
}

and when the images are finished, clear the float:

out.print("<div style=\"clear:both;\"/>");

much better to do all that with an MVC framework though, if you're using JSP, like Spring and taglibs rather than raw output

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜