Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have got few image child elements for the parent div element. I want to align the child element to the center of the page irrespective of the number of child image elements.
for example: if I include only one image element then it should be aligned in center or if I include 4 image elements the 4 images must be aligned to the center of the page.
the adding of the image can be done dynamically by the user in the website.

Can anyone please help me fix this issue
Posted
Comments
Kornfeld Eliyahu Peter 8-Oct-15 4:57am    
It would be nice to show us your code...

XML
<div class="wrapper">
  <img src="" />
  <img src="" />
  <img src="" />
</div>

CSS
.wrapper{
margin:0 auto;
padding: 5px;
border:solid 1px #ccc;
  text-align: center;
}

.wrapper img{
  display: inline-block;
  margin: 0;
  padding: 0;
  margin-right: 5px;
  width: 100px;
  height: 100px;
  outline: 0;
  border:solid 1px #ccc;
}


See the demo[^]

-KR
 
Share this answer
 

Your content Here
 
Share this answer
 
v2
Comments
user 3008 12-Oct-15 7:21am    
Sorry about I cannot see your answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900