Jump to content

Divs sizes


MattUK
 Share

Recommended Posts

Hi all,quick question.I am playing around with some basic templates and I am just getting into CSS and using divs also, my question is when I give dimensions to the div, I put my content in (text) but the div changes shape with the text..which I dont want? How do I lock the width and height of a div so that it will not change shape at all ?Thanks for your time :) Matt.

Link to comment
Share on other sites

Just give absolute dimensions(in pixels) to the div(width: ###px; height:###px;) and if it still doesn't work, add "overflow:hidden". As far as I know, this would hide every part of the text that passes the specified dimensions, thus keeping the div unchanged.

Link to comment
Share on other sites

Just give absolute dimensions(in pixels) to the div(width: ###px; height:###px;) and if it still doesn't work, add "overflow:hidden". As far as I know, this would hide every part of the text that passes the specified dimensions, thus keeping the div unchanged.

Thanks Boen_robot, I did try the width and height method but the div was changing shape, I have just tried the over flow and it works perfectly...Thanks very much :) Thank you.Matt.
Link to comment
Share on other sites

Actually, I wouldn't use overflow: hidden, because that would just hide text that doesn't fit in the div. Try using overflow: auto instead, that way you'll get a vertical scrollbar in the div.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...