When I set position:absolute
for an element, its width
remains constant regardless of the text inside.
However, if I set position:relative
for the same element, the width
will adjust based on the text content.
I have created a fiddle with two menus, each styled differently using the position
property:
http://jsfiddle.net/je3PX/4/
What is causing this difference? Why does the width
change based on the position
attribute?
I am aiming to make it flexible according to the text size.
Appreciate any insights. Thank you.