This may be the stupid question,but I can\'t figure it out how to get this.
edit: I just want to center only text horizontally not the image and the image must be remain
Building on Afzaal Ahmad Zeeshan's answer...
Put the text between 2 equal images. Set text-align:center
on the containing div. This centers the image-text-image as a group.
Then hide the second image.
HTML:
This works now.
CSS:
div {
text-align: center;
}
img {
width:30px;
height:60px;
}
.cannot-see-me {
visibility: hidden;
}
This works because visibility:hidden
makes an element invisible, but it still takes up space on the page. So use that here instead of display:none
.