Showing posts with label Cascading Style Sheets. Show all posts
Showing posts with label Cascading Style Sheets. Show all posts

17 October, 2013

Stylesheet folder or directory - could make or break your web apps

English: CSS rule in Malayalam
English: CSS rule in Malayalam (Photo credit: Wikipedia)
17-October-2013

I have been reading on ASP.NET, so at least I learn something new. I have been coding and coding and coding, and I have become the woodcutter who did not sharpen his axe. And with the slowdown in load (all major projects completed, and pending roll-out only), I have some free time on my hand.

I found an e-book of Beginning ASP.NET 4.5 in C# and VB, and I skipped the chapters that discussed basic web development, but coming to Chapter 3, I found the CSS section a bit of an eye-opener. Not that I know nothing of CSS -- it is something that I have used extensively on my site, but not entirely the optimum way. And what I have just learned, I tried to apply on one of my simple web applications.

Did I find something to blog on?

You betcha!

I am one who always practiced organization, and I just find that the stylesheet file that was created in the process is 'mixing' with the code files. I just didn't like that. So in the middle of streamlining the CSS codes, have done some pages already, I moved the stylesheet to the \App_Code folder. There was no objection in the IDE...

So, I completed migrating all the inline and embedded styles into the Stylesheet file, so they are all in one common place, and this gave me a chance to remove all redundant and duplicate styles. Wow! Just think of the junk I created... And that is just in the simple web apps...

Anyway, having done everything, I now proceeded to test if what I did works.

Surprise, surprise!

In IE, it did not work. I am using IE10, running in Windows 7 Enterprise. The fonts and colors are all using the default values.

I tried it in Maxthon, in most likelihood, the closest browser to IE. The same behaviour was observed.

I now tried Firefox, and the styles came forth, shining through!

But since the majority of browsers used in our company is IE, I have a problem...

I tried defining the font in the individual rule sets, since the * { font: ...} rule doesn't seem to work at all.

No change.

I put the font definition in the body { ... } rule, and still, no effect.

At this point, I now thought of doing one thing: search the web. Search the web for similar issues and of course, the possible solution to my problem.

Found one article that mentioned the problem to be related to some server issues, and also on the folder/directory that keeps the stylesheet file. Spaces must be replaced with underscore (_).

Well, mine is having an underscore (\App_Code\), so I ruled it out.

I stopped for a while, and tried to think some more...

Then, out of a wild guess, I thought of moving the stylesheet file out of \App_Code\ folder, and back into the main folder.

Did that work?

Yes, it did!

So it wasn't the folder having spaces, and it wasn't the server behaving erratically, but simply, and I confess I don't know why (I don't understand it), the problem was simply due to where the stylesheet file was located.

So a few more code corrections, putting back all those definitions [ * { font: ... } ], and making sure all sections work, I published my modified web apps.

Hopefully it is much faster now.

Till then!
Enhanced by Zemanta

18 April, 2011

Scriptin' with Javascript and Ajax

Charles Wyke-SmithImage by linoleum jet via FlickrI am done reading this book, and while I can say that it is almost in the same line of methodologies as the other book from Riders (Bulletproof Ajax), they have different offerings.

Scriptin' focuses on reuseable javascripts, and the final two chapters is supposed to be a working example that brings in all the discussed knowledge.

Unfrotunately for me that can't materialize. It was dealing with PHP, and I don't have a server that runs PHP.

Anyway, the javascripts I have learned just fine, expecially those nice formatting techniques, stripes, character counting, etc., etc.

And of course, these functionalities, more or less, are somewhat available in the Visual Web Developer toolkit.

So what's good about this book?

I know from the ground up how these already-available controls work. If I have to code by hand, I may struggle, but I can survive. I can continue. I won't be stuck.

I can go on Scriptin'!
Enhanced by Zemanta

12 April, 2011

Fonts to Use, in Web and in Print

Cover of "Looking Good in Print"Cover of Looking Good in PrintI've been reading the books by Charles Wyke-Smith, and once again, I have come across the idea of what font is suited best for which application.

I read it long time ago in 'Looking Good In Print' - a book that tells how to style and arrange a page, and what fonts to use, on the title, the text, the headers and footers - everything you need to know and do when it comes to printed materials, and the one thing that I can remember well from that book is when it said that the font best suited for printed matters is serif fonts.

I could have easily made the mistake of saying that that idea was confirmed in one of Wyke-Smith's books, but fortunately, I checked back again.

The book that I have just finished reading, which confirmed that idea is the book by w3schools.com: "Learn HTML and CSS with w3schools" and "Learn CSS with w3schools".

To recap, here's what it said:

For the Web, use sans serif, font size about 12.
For Print, use serif fonts, using smaller font size of about 10.

And this is done by using the '@media' style selector.

Till then!

Learn JavaScript and Ajax with w3SchoolsLearn HTML and CSS with w3SchoolsLearn CSS with w3Schools

Enhanced by Zemanta