开发者

Change image layout orientation

开发者 https://www.devze.com 2023-02-16 03:05 出处:网络
I am display开发者_StackOverflow中文版ing the images here..they are arranging in vertical way by generatingdynamically...But i want it in horizontal pattern...how can i do this?

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

精彩评论

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