This took a little more work... ;-))
Scalable Blog Title...
CSS3 brings some new, nifty toys to play with. One of these is the length value "vw". A value of 1vw equals 1% of the viewport (browser) width. So this is a css "length" that will vary with the browser width.
I was playing with this and figured, "Well heck! If I have the Blog Title overlayed on top of the (scaleable) header image (previous post) I just made, this nifty vw value could be used to make the Blog Title scale right along with it! I entered "font-size: 1vw;", it was too small. So I played with the number until I got a Blog Title size that looked just right... I then made the browser smaller and smaller and the Blog Title got smaller and smaller.
Cool Beans!
That is until I realized that the Blog title was getting
too small relative to the header image, and it was also losing its positioning vertically... Not my desired outcome.
So... With a bunch of playing around, I've been able to achieve an acceptable scaling and positioning. If you try this, you'll likely need to play with the numbers some depending on the font you choose.
Besides the new "vw" length measurement I mentioned, CSS3 also allows you to do some calculating
within the css stylesheet by using the "calc()" function. Unfortunately, browser support for this is still buggy, so while at some point in the future there might be a more elegant solution, this works in Atahualpa now.
You'll need to realize that Atahualpa has two areas where you can add css that will affect the Blog Title.
In the "Header Image" area, the "Overlayed Blog Title/Tagline Style" is used to add css to the container that holds the Blog Title. Here is the css I used...
Code:
position:absolute;
height:100%;
top:0;
left:2vw;
font-size:1vw;
This positions the Blog Title container. The left:vw positions the container a little to the right and because it scales with browser witdth, that distance stays consistent.
The font-size is set here because in the next section (h2 tag) the buggy calc() function doesn't play nicely with vw in all browsers, however using em works. Because this container is the parent of the h2 tag, 1em will equal 1vw. As they say... "Its the same thing, only different!" LOL.
In the "Style & Edit HEADER AREA", "Blog Title" is css for the h2 tag for the Blog Title. Here is what I used to position and scale the Blog Title.
Code:
position:absolute;
bottom:10px;
width:20em;
padding: 0;
font-size:calc(18px + 1.6em);
The positioning and width are to ensure the correct placement of the h2 tag in its container. The width of 20em references the 1vw and so scales with the browser width.
Remember I mentioned that just scaling the Blog Title vs. the browser width made for the title being too small when the viewport (browser) was small? This is how I compensated for that. With the browser set to being small, I determined that 18px was a good size. I then expanded my browser to full desktop monitor size and then tweaked the em setting (which effectively changes as the browser gets smaller) for the largest that I wanted the font to appear.
The Blog Title now scales the way I want it to!