Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

a tag taking some extra space in html

I put an image inside the a tag. but when i gave border to the image and a tag. The A tag taking some extra space. it is not surrounding the image.how to overcome those extra space by 'a' tag. i am indicating a tag in red line.

My html:

<a href="#"><img src="http://img165.imageshack.us/img165/1043/burnhr6.png"/></a>

Css:

img
{
    border:1px solid black;
}
a
{
    border:1px solid red;
}

http://jsfiddle.net/rEPXY/2/

like image 226
Anish Avatar asked Jan 25 '12 03:01

Anish


People also ask

How can I eliminate the extra space after a tag in HTML?

Approach 1: We can remove space between any two tags by simply using margin-bottom property. The margin-bottom property sets the bottom margin of an element. We will assign a negative value to the margin-bottom of a particular tag to eliminate the extra space between the tags as shown.

Which tag is used to give extra space in HTML?

You can use the &nbsp; HTML entity to create blank spaces in both paragraph text and text in tables, for example. Since there is no blank space keyboard character in HTML, you must type the entity &nbsp; for each space to add.

How do I reduce space in HTML?

It turns out that's pretty simple: just use the line-height CSS property and then apply it. I have an example below. Then, you can apply that CSS class to your HTML. Now, the space between the lines changes.

What is &nbsp in HTML?

A non-breaking space prevents line breaks from occurring at a particular point in an HTML document. To use a non-breaking space, you would use the following: &nbsp; For example, if you wanted the words "Mr."


1 Answers

Is something like this what you are looking for?

a
{
    border:1px solid red; display:inline-block; line-height:0;
}
like image 124
ToddBFisher Avatar answered Nov 15 '22 11:11

ToddBFisher