OK. So, I'm working on a new personal website, and I've run into a problem. Here's the code:
tit {
color: #8dc63f;
font-size: 150%;
font-family: Georgia, Tahoma, 'Lucida Sans Unicode', 'Lucida Grande', sans-serif;
font-weight: normal;
}
rtit {
color: #8dc63f;
font-size: 150%;
font-family: Georgia, Tahoma, 'Lucida Sans Unicode', 'Lucida Grande', sans-serif;
font-weight: normal;
text-align: right;
}
These are intended to function as custom header calls, so that I can make changes to them without affecting all of the headers that reference the stylesheet. "tit" works just like I want it to. "rtit", however, does not; it is still aligned on the left. What am I doing wrong, here? I've tried about a dozen different things, but nothing has worked. I am sure that making it a <div> or <p> function would fix the problem, but I don't want to force a double line-break between the "rtit" header and actual paragraph of text it introduces.
I should mention two additional things. First, I'm trying to be fully compliant to Strict XHTML. Second, I am entirely self-taught, so I'm sorry for any incorrect terminology or jarringly obvious mistakes.
Let me know if there is any other info I need to post in order to clarify my problem.
Posts
http://www.thelostworlds.net/
Also, <tit> </tit> works just fine.
Twitter | Facebook | Tumblr | Last.fm | Pandora | LibraryThing | formspring | Blue Moon over Seattle (MCFC)
<h1 class="tit"> HAHAHA </tit>
Not sure but I am always confused as to the difference between class and id CSS/HTML
Hope I didnt make more confusion out of this.
― Dr. Seuss, Oh, the Places You'll Go!
If you want it to be blocks of text then add to your CSS. This will force a new line between your boxes like a <div>, but will also increase the width of the box to 100%, so the text in rtit will be on the right of the page.
If you want it to be all on the same line, you might have to play around with floating it to the right.
As Horus said: that's not XHTML. It won't validate. You need to assign classes to actual XHTML tags. You should read more about what XHTML/CSS is.
Once you get that right (usually you'll use a div) then put a black border around the element; you'll probably find it's only as wide as the text (as you haven't specified a width), so it's right-aligned well enough, but it's right-aligned against a box as big as it is.
I am developing this website mainly to edify myself, because XHTML/CSS has essentially been grafted onto my job description. So far, when I have been called on to use those assets at work, I have either found a web tutorial that enabled me to do get more or less the result I was hoping for, or I cannibalized existing code that approximated what I was looking to do, and modified it using trial-and-error.
Most of my study has been confined to the W3Schools website, or the W3C website itself; my employer also provides access to the entire O'Reilly catalog in digital format, but that is only accessible at work. Do you have any better suggestions as to resources? My preference is for free and online, but my employer will potentially put a couple thousand dollars into training on this, so any resource is worth considering.
Twitter | Facebook | Tumblr | Last.fm | Pandora | LibraryThing | formspring | Blue Moon over Seattle (MCFC)
http://htmldog.com/
XHTML is not hard if you have no pre-conceived notions as to what HTML is and what HTML isn't, the old-school (including myself) find it hard not to "cheat" and hack an old way of doing something into XHTML.
CSS is harder to grasp, if only because 50% of the time it won't do what you expect. When you do find it does what you expect, it won't work in Internet Explorer. But this is for the big issues, simple sites should be fine.
Oh yeah, HTML Dog. That's what I was looking for. That's a great site.
They also spare you the preachy nonsense that is generally associated with a lot of tutorials on the web these days while still pointing out and encouraging "best practices".
I do have a fair amount of experience with HTML, although so far my pre-existing knowledge has served only to help, it seems...at least in the sense that I know enough to get things to look and respond as I want them to, whether or not it is technically correct.
On the upside, all of my web development work will be internal, and we recently phased out IE and Opera; new tools and pages need only display correctly in Firefox.
Twitter | Facebook | Tumblr | Last.fm | Pandora | LibraryThing | formspring | Blue Moon over Seattle (MCFC)
Oh well.
Here's to learning. After XHTML/CSS, it's on to PHP and XSLT. Hurrah!
Twitter | Facebook | Tumblr | Last.fm | Pandora | LibraryThing | formspring | Blue Moon over Seattle (MCFC)
Anyway, it is probably recognizing your custom tag due to a browser quirk. In reality even if you technically can do such things, you shouldn't, because as you have discovered they are unreliable at best.
You CAN use element selectors for existing tags such as <td> or <body>, however that would fall under the category of "intermediate" practice.
Before you can walk, you must learn to stand, etc.
Fix'd
I started with them in the fall of 2005, doing part-time data entry. Three weeks later, I was working full-time, handling the internal wiki system and writing some internal webpages, with both Java and HTML. About two months after that, I was moved into a special joint team of our IT and Programming departments, mostly designing and writing validation documentation, managing our team of testers, and seeing our labkey work from use case stage to release one. I was offered a project manager position about eight months later (roughly at my one-year mark), which I turned down, since I suspected that I'd eventually get tapped for either dedicated web-dev or object-oriented programming.
As it turns out, my hunch was correct, and I'm being transitioned. As long as they are throwing more money at me, I am happy to learn whatever they want me to, especially if it means that my personal skillset grows more marketable at the same time.
All that being said, I am a little apprehensive about self-teaching myself PHP and XSLT, especially since I come from a hardware background, and only hold degrees in Anthropology and Psychology.
Twitter | Facebook | Tumblr | Last.fm | Pandora | LibraryThing | formspring | Blue Moon over Seattle (MCFC)
PHP will be fine for someone of your background.
It's XSLT that's going to kick you in the balls.
i breathe css and php right now.. but xslt... no way.
I noticed something about id and class being necessary... they really aren't, and in fact you should avoid using them when you don't need to. If all of your h1 tags are going to be formatted the same way you should just reference the tag itself instead of assigning a class / id to each tag.
You should also avoid inventing your own tags unless you want to create your own doctype and definition, which won't be fun. The tags built in to xhtml should be all you need.
Probably the biggest thing to know is the difference between block level elements and inline elements. Take a look at the links below....
http://www.autisticcuckoo.net/archive.php?id=2005/01/11/block-vs-inline-1
http://www.autisticcuckoo.net/archive.php?id=2005/01/12/block-vs-inline-2
http://cat.xula.edu/tutorials/html/versus.php
Some other good resources:
http://www.alistapart.com/ --> Often has articles on nifty stuff you can do with CSS / XHTML
http://positioniseverything.net/ --> Lists the broken functionality of different browsers and how to get around them. Good resource for making stuff work in IE (it will be the bane of your existence).
If you are going to be learning PHP on your own I'd suggest you find someone who knows a lot about it to look over your first few projects. Even with being a simple language to learn it has a lot of potential traps that new users fall in to. My best suggestion would be to trust nothing the user submits (validate everything) and you should be all right.
http://www.ilovejackdaniels.com/php/ --> Excellent resources / articles / cheatsheets for all things web-design.
It might be worth reading through the O'reilly books on PHP as well... I've found them to be pretty useful.
Finally, you'll probably want to develop in Firefox with the Web Developer and Firebug extensions. Web Developer has tons of nice tools for debugging a site design (element positioning, etc) and Firebug is great for debugging javascript.
I also use the DOM Inspector, InspectThis and JSView extensions... DI lets you view any attribute of any element in the document tree, inspectthis lets you select a page element in the DI by right clicking it and JSView lets you avoid hunting through a sites source to find the JS / CSS files it references. Make sure you know where the Firefox errror console is (right side of the screen in web developer)... it's really handy.
Sorry if any of this seems overly simplified or anything... I'm not sure what your experience level is.
Good luck!
Thanks for your post, Kev. I knew that establishing a class was not necessarily required (mainly because of unclassed header and blockquote attributes in the examples of code I've seen), but not that it was actually inadvisable where avoidable. Also, I have, as Lewisham suggested above, printed off several chapters of the O'Reilly books (just HTML/XHTML and CSS at this point, but PHP soon enough, and then...XSLT).
I hear what you're saying about validation; as a matter of fact, establishing and overseeing validation practices within our object-oriented programming team is actually my primary job. I definitely recognize the importance of making sure that I am not only getting desired results, but getting them from code that is compliant to a sensible, consistent standard. Luckily, while I will be learning PHP on my own, I will have several resources (including actual coworkers) around to offer material assistance. XSLT, on the other hand....
Yeah. I'm just going to have to accept the fact that the company's going to have to lay out some fliff for actual training on that one.
Twitter | Facebook | Tumblr | Last.fm | Pandora | LibraryThing | formspring | Blue Moon over Seattle (MCFC)
once you get this down, you can get into psuedoselectors! wooo!