Is it possible to set some width to the <a>
tag in html ?
If yes what is the way, if no is there any work around ??
You can redefine it as a block element and then set width to it: a{display:block;width:400px} .
The width attribute on an <img> tag sets the width of the image. The width is specified in pixels -- without the 'px' unit.
If you set the width to 100% on the body element you will have a full page width. This is essentially equivalent to not setting a width value and allowing the default. If you want to use the body element as a smaller container and let the HTML element fill the page, you could set a max-width value on the body.
It is a reliable standard that works on most devices down to a 1024 pixel display width including space for scroll bars and such.
You can redefine it as a block element and then set width to it: a{display:block;width:400px}
.
EDIT: However, in this case it will start on a new line and the next piece of text will also be in a new line. What solves the problem, is inline-block
display mode, but this again has problems with older versions of IE and FF (see here: http://caniuse.com/#search=inline-block)
The css width
property does not affect inline elements such as <a>
or <span>
. In order to use block-level properties like width
, you'll have to declare your element as a block-level element, using display:block
:
<a style="display:block;width:200px">Your link</a>
If You didn't Like display:block
or display:inline-block
You Can Use The Padding
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With