Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display two images side by side on an HTML Page

I am trying to place two images of the same size side-by-side. If I use a table then I am able to display both images side-by-side. But in my CSS Stylesheet I am using a custom format for the table and this shows on the page containing the images, too.

I want to just display both images without any custom background, border, etc.

I tried using div, span, ul & li (etc.) but failed in each case.

  1. How can I place two images (of the same size) in a single line, without using a table?

  2. If I have to use table for the same, then how can I use two (or more) different formats for my tables using CSS?

like image 261
LalitBarik Avatar asked Dec 23 '22 03:12

LalitBarik


2 Answers

You can do like:

<style type="text/css">
  .left{float:left;}
</style>

<img class="left" src="path here" />
<img class="left" src="path here" />
like image 121
Sarfraz Avatar answered Dec 27 '22 02:12

Sarfraz


Use float:left; you say that you are finding a little left margin so you can try this

.left{
    float:left;
    margin:0;
    padding:0;
}

this may be cause of margin or padding. or you should use body tag like

body{margin:0;
padding:0;
}

then you have no need for write margin:0; padding:0;.

like image 25
Kali Charan Rajput Avatar answered Dec 27 '22 02:12

Kali Charan Rajput