Jump to content

Styling tab sizes


Grabeorama

Recommended Posts

Nope. Note that the xmp tag is deprecated in HTML5. But using the pre tag won't solve the problem either.Here's an alternative. Use a div or p tag, and in CSS style it like this:

div.pre {   white-space: pre-wrap;}

I just discovered that trick a couple days ago, and it solved a really nagging problem I was having with formatted text in a table cell.

Link to comment
Share on other sites

Basically all I wanted was a method to display HTML code on a site, without it being interpreted as HTML or without using the "<" code. So I used the <xmp> tags. The only problem was the tabs were much too wide, and looked a little stupid so I wanted to decrease their size in CSS, but I don't think it's possible.Is there any other way of doing this?

Link to comment
Share on other sites

Oh, I see now. Well, <pre> tags are now recommended over the <xmp>, but I don't think you can control the way tabs are formatted, and changing the tag to pre won't make a difference. I agree it's annoying.Maybe you want to look into a server-side library that reformats things designated as code so they look like code. I have such a plugin on my wordpress site, and it looks great, but of course it's for wordpress. I can't imagine there's nothing similar for ordinary pages.

Link to comment
Share on other sites

Hmm, yeah I was trying to avoid complicating it too much with server side libraries. I like to have coded everything myself so if something goes wrong I have a much better chance of fixing it. I'll look into it though, there's surely a few PHP libraries out there that do what I'm looking for. Thanks for the help :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...