Archive Page 3

Brian’s previous post reminded me about a mnemonic I use to remember how CSS borders/margins/paddings are defined (surely there’s a word for what I’m describing). Anyway, in a declaration such as:

#wrapper {
margin: 0px 0px 0px 0px;
}

The margin-top, margin-right, margin-bottom, and margin-left are all 0px, and are defined in that order.

To remember this, I think of TRBL: top, right, bottom, and left. Trouble. Not that you’ll be having any trouble if you remember it that way.

Additionally, you can define just two of the four and have your browser substitute them for the remaining two. That is,

#wrapper {
margin: 5px 0px;
}

This creates a margin of 5px on top, 0px on right, and then substitutes to make the bottom 5px and the left 0px also. Most everyone is familiar with defining just one and having that be used for all four also.

Started getting a lot of hits out of nowhere today, then someone who owns LS1Tech send me a pThread on PBO asking about MF and where we were taking it, and that vBulletin was getting old.

He mentioned he found a link to us on Slashdot, so I went looking, and found it. Nothing too crazy, but perhaps this is the beginning of a trend to where people completely unrelated to us are beginning to mention metaforum. Thats the type of grassroots exposure I feel like we’re lacking really, so maybe we’re hitting a tipping point.

Or, maybe it will just become unmanagable for a 2 person team and we’ll have to retire it and work on something else. Who knows.

I’m using some of the YUI CSS files to make sure fonts look the same when viewed in IE and Firefox. For the Yahoo stuff to work correctly, you need a doctype of HTML 4.01 Strict so that the browser doesn’t go into quirks mode.

The HTML I’m creating is generated from a XSL transform using C# under the .NET Framework 2.0. I based my transform code off an example from MSDN and figured the XSLT file would handle the formatting options from within the xsl:output tag.

<xsl:output method='html' indent='yes' doctype-public='-//W3C//DTD HTML 4.01//EN' doctype-system='http://www.w3.org/TR/html4/strict.dtd' />

I had this problem where every time I ran the XSL transform, the resulting HTML document would have no doctype at all. The problem is that I was passing a XmlWriter to the XslCompiledTransform.Transform method, as is shown in most examples. It makes sense now that I think about it, though: strict HTML isn’t well-formed XML. I tried using XmlOutputMethod to force it into HTML, but, of course, this setting is obtained from the XSL declaration above.

If you’re not outputting an XML document, use a StreamWriter to write the transformed file.

XPathDocument xp = new XPathDocument(xml);
XslCompiledTransform xslt = new XslCompiledTransform();
StreamWriter sw = new StreamWriter(outfile);
xslt.Load(xsl);
xslt.Transform(xp, null, sw);
sw.Close();

For XHTML, I imagine the XmlWriter would work fine.

For some reason when I first started learning CSS and the box model, one of the hardest things I couldn’t figure out how to do was simply center a box in the middle of the screen. Back in the old table days, it was easy — just wrap center tags around your table, and viola.

Well now I know much better. With CSS its actually just as easy. Just add the following to lines to your CSS div definition of choice:

margin-left: auto;
margin-right: auto;

This probably only works on relatively positioned elements, that are in the normal flow.

Back to Basics

04Oct06 admin

After letting our old blog languish for what seems like years, we’re back. We switched to a more capable publishing platform (that’s their slogan anyway) and hope to communicate some stuff about our development process.


You are currently browsing the Code in Focus weblog archives.

 

Bad Behavior has blocked 14 access attempts in the last 7 days.