CSS Text Box cutoff

css Australia
  • 14 years ago

    hello all,

    I need to have a textbox that cuts off (but keeps the text) after a certain number of pixels. I need this because I have a background image on the text box that is 672 pixels wide, and has caps on either end. I can use padding-left to indent the text but i can't get the text on the other side to do what i want it to.

  • 14 years ago
    I'm not entirely sure what you are wanting.

    If you are wanting to stop text overflowing the boundary of a box, or to stop it expanding the size the box, then you may need to explore the css "overflow" attribute.

    For example, if you give a box a fixed width and height then set "overflow:hidden". You will ensure that any text that would overflow the stated size is hidden from view. Alternately, using "overflow:scroll" will put scrollbars within your box; allowing the user to scroll within the box to view all the content.

    Alternatively, perhaps you need to have a containing div, which has the background image and is set to 672px pixels wide, with 0px margins and padding. Then, within that, you create another div to contain your text with appropriate margins to indent the text on either side.

  • 14 years ago
    I was using a text box and needed it to be indented because the background image had a border. I fixed it by putting in a div and margins on the div, which worked exactly the way I wanted it to. Thanks for the help.

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“C++: an octopus made by nailing extra legs onto a dog.” - Steve Taylor