Capitalization code

General help with pet/account decisions, galleries, CSS/HTML and so on.
Post Reply
kerise1
Posts: 21
Joined: 24 Feb 2008 05:28 am
Gender: Female

Capitalization code

Post by kerise1 »

Can anyone tell me the code to capitalize the pet name on a petlookup? Just the name at the top & in the stats. When I try, everything on the page becomes capitalized, even the description.

Thanks!
Jessi
Posts: 3413
Joined: 09 Mar 2006 06:29 pm
Human Avatar: 155904
Location: Seattle, Washington
Contact:

Re: Capitalization code

Post by Jessi »

There is no code to capitalize just the pet's name. Trust me. I've tried many a time with my Plushie Bori.

There's a way to capitalize only the bold text, which helps a bit - that code is:

Code: Select all

b {text-transform: capitalize;}
Unfortunately, it won't correct the main header - for example, on my Plushie Bori, where it says

'rayuca the Plushie Bori ' - that part is bold, but its also its own (undefined) class and you can't do anything about it. I've tried everything without wanting to capitalize all the text, even tried making an image go over it. No dice.

If you see the lookups where people have used a code to capitalize the pet's name but not the text in the profile, it's because they did the profile BEFORE they added the code, screencaped it, saved it as an image and just have the image with the text and what not in the lookup instead of actual text.

Go take a look at my Bori if you want - I just have the bold text capitalized and really, the 'rayuca the Plushie Bori' thing doesn't bother me as much as it once did. I like having just the bold text capitalized a LOT more than having everything capitalized.
thelonetiel
Posts: 1067
Joined: 07 Jan 2006 08:56 pm
Gender: Female
Human Avatar: 15268
Location: Nuevo Mexico, Estados Unidos

Re: Capitalization code

Post by thelonetiel »

I think I might've got it, tell me if this works for you. Exampled here.

Code: Select all

<style>
td.content, b {text-transform: capitalize;}
td.contentModuleContent {text-transform: none;}
</style>
td.content is the mainframe that houses all the stats, so it includes the main header, then td.contentModuleContent is the majority of the individual frames, so they are reverted back to no capitalization. Then like Jessi pointed out, the bold will capitalize the rest of the instances of the name on the page, though unfortunately other stuff gets capitalized too.

Edit:
And should you want it capitalized on your lookup, this should only affect the names. :)

Code: Select all

div#userneopets b {text-transform: capitalize;}
Glad I got a new uncapitalized lab rat I could play with for you guys! ^^
Last edited by thelonetiel on 08 Mar 2009 08:06 pm, edited 2 times in total.
Jazzy
Devil's Advocate
Posts: 2038
Joined: 04 Jan 2006 06:06 pm
Gender: Female
Location: a g-orbital
Contact:

Re: Capitalization code

Post by Jazzy »

Actually, you can do it a lot more selectively - you can't restrict it to just the name, but you can restrict it to just "Petname The Colour Species". Here's an example, using all-caps instead of capitalising individual words (because his name is already capitalised):
http://www.neopets.com/petlookup.phtml?pet=Narkhi

Compare this with one of my other pets, no CSS:
http://www.neopets.com/petlookup.phtml?pet=Linotype

As you can see, there are a few things which also change case. These are online neofriends (classes neofriendInfo and neofriendUsername), Attributes and Battledome Stats (which won't matter with you, because they'll look the same as normal if you're using code to just capitalise the first letter), and finally, the "Rate Narkhi" (rating_ballot, an id and not a class) and "Disable Rating" (pet_rating, also an id).

So, to only change the line which says "Narkhi the Green Grarrl", reverting those other parts to normal capitalisation:

Code: Select all

div{text-transform: capitalize}
td{text-transform: none !important;}
.neofriendInfo,.neofriendUsername,#rating_ballot,#pet_rating{text-transform: none !important;}
This works because most of the text on the page either has a class, or is in a table - but the name line isn't. It's just in a div.

Hopefully this helps someone :) Let me know if there are other bits which also end up capitalised in practice.
Jessi
Posts: 3413
Joined: 09 Mar 2006 06:29 pm
Human Avatar: 155904
Location: Seattle, Washington
Contact:

Re: Capitalization code

Post by Jessi »

Tiel, I told you in MSN, but THANK YOU SO MUCH! And you too, Jazzy xD Ty and I spent hours trying to figure out how to do it and just couldn't get it done ;__; So I'm really glad someone was able to figure it out! As soon as I get home (at a writer's meeting right now xD) I'm going to go prettify up Rayuca's lookup a bit more :D
covet
Posts: 756
Joined: 24 Feb 2006 09:57 am

Re: Capitalization code

Post by covet »

You guys are amazing. I had it capitialised on my main lookup but thad no idea there was a way to do it on petlookups, too. One question:

http://www.neopets.com/petlookup.phtml?pet=xthrone

Is there a way to capitalise her name on the 'likes gathering food etc' part?
The Artist Formerly Known As Amneris
Image
thelonetiel
Posts: 1067
Joined: 07 Jan 2006 08:56 pm
Gender: Female
Human Avatar: 15268
Location: Nuevo Mexico, Estados Unidos

Re: Capitalization code

Post by thelonetiel »

Covet, if you include "b" (for bold) in the code, it will capitalize all the bold bits, which happen to include all other instances of the name on the page. The only downside is that it capitalizes "Likes Gathering Food" as well, but it works well. So in Jazzy's, you'd change "div {text-transform: capitalize;}" to "div, b {text-transform: capitalize;}". Or just copy the code Jessi initially posted into your style sheet, if that's easier, you don't have to worry about running out of space it looks like. :)

I'm not sure if I agree with Jazzy that including all divs is best, I think the td.content is more precise, but either works. ^^
covet
Posts: 756
Joined: 24 Feb 2006 09:57 am

Re: Capitalization code

Post by covet »

XD I haven't actually added a lookup description yet, clearly, but I tend not to do epic ones. Thanks! I shall go and prod at it.
The Artist Formerly Known As Amneris
Image
kerise1
Posts: 21
Joined: 24 Feb 2008 05:28 am
Gender: Female

Re: Capitalization code

Post by kerise1 »

Thanks everyone!
I'll try it out ^^
Jazzy
Devil's Advocate
Posts: 2038
Joined: 04 Jan 2006 06:06 pm
Gender: Female
Location: a g-orbital
Contact:

Re: Capitalization code

Post by Jazzy »

Tiel, the whole point of my code is it is more specific - your code capitalises bits which don't need to be. If you use divs rather than bold text, you don't get "Act Very Friendly" and things like that. Here's one of my pets where I've included the full code - again, uppercase, because she has a capitalised name. It really does only affect "Petname the Colour Species", along with "attributes" and "battledome stats" which, as I said above, will look as though they haven't been changed if the person uses capitalize rather than uppercase.
thelonetiel
Posts: 1067
Joined: 07 Jan 2006 08:56 pm
Gender: Female
Human Avatar: 15268
Location: Nuevo Mexico, Estados Unidos

Re: Capitalization code

Post by thelonetiel »

If that's the effect you want Jazzy, you just need to take the "b" addition out of my code and it'll do the same thing, just in fewer characters and using exact classes. :) Jessi seemed to want the instances like "Name likes hunting for treasure" to be capitalized too and I assumed others would as well. Unless I'm totally missing something, the rest of the code shouldn't capitalize anything other than the top "Name the Color Species."
Post Reply

Who is online

Users browsing this forum: No registered users and 34 guests