Using css: css – way to not have width assume 100%? on newest questions tagged css – Stack Overflow

So when you put a <div> within a <div>, it assumes it should be all the way wide.

I have an <a> element, and the only way to get it to display correctly is to give it display: block. However, giving it this attribute makes it behave like the <div> does by default. It makes it all the way wide.

I don’t have a specific width I want it (just so the text and padding fit) but I don’t want it to be all the way wide.

Is there an attribute/workaround for this?

I would post some code but it’s a simple enough idea – just say so if you’d like to see some code.

See Answers


source: http://stackoverflow.com/questions/4210681/css-way-to-not-have-width-assume-100
Using css: using-css



online applications demo