Good practice with CSS — One sheet for each page? [closed] - css

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
The question is simple: it is a good practice we have one "master CSS file" (the same concept of master pages) and, for each page, one specific and unique CSS file?
I ask this because I think that it's useless to have very different code on a page that will not use it — can you all understand me?

From a UI point of view...
Use separate CSS if:
You have almost independent pages with less common stuff
You need to reuse specific pages in different projects
Use single CSS if:
You have lot of common styles

The greatest advantage when using one master CSS file than having a master and several specific CSS files is that
You save on HTTP request times and resources. If you have several files, you need to call your server a few times and waste on the metadata.
Everything is in one place, you get to edit them more easily. CSS becomes more managable for your website.
Caching helps greatly.
The redundant / unused style rules in your master file may be too little to matter much.

In my opinion it is best to have as less number of stylesheet (css) and JavaScript files as possible to reduce number of HTTPS requests.
Having one large css file is better then having 5 different files as most likely the css file will be cached in the user's browser after initial request and cached CSS file will be served after first request.

Yes, it is best practice for the following reason:
When the user loads your website they will take the hit of downloading the singel CSS file on first load - thereafter it will be cached by their browser for every page on your site under your main domain. This means no more loading of the CSS file from the server for surfing your site and faster page loads.
If you have separation concerns from a code structure point of view I would encourage you to consider some CSS pre-compilers such as SASS or LESS that will allow you to structure your code in a nicer way.

Related

Does anyone still writes websites from scratch? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I'm diving into web design and development. I wrote a couple of website (just client code) from scratch, starting with just a touch index.html. Is this practice still used or most of the web is made out of templates, Wordpress or some other expedient?
I think 3 things are enough to create good websites (showcase websites or small web app):
Server-side = Understanding a CMS , its structure, and its core functions + Having
basic server language notions. In the case of this OP (Wordpress-PHP combination is good).
Client-side : CSS3 + HTML5 + Javascript (Jquery or equivalent).
AJAX as a 'bridge' between the two sides.
Doing things from scratch without using a CMS is good for knowledge but requires more time.
I think there are 2 questions here:
1) Is this practice still used?
Yes, you just used it. Browsers will support it, so someone out there will be doing it.
2) Is most of the web made out of templates, Wordpress, etc...
Yes, I would think so.
You could go the other direction and bypass a web server and create a program that responds directly to HTTP requests on port 80, but using a webserver saves you the trouble of programming and allows you to work with files. Using something other than touch index.html is just another step beyond that, using a more expedient way to get to the html files you need.
It's not saying that all websites must be dynamic - for example, my own blog is written with middleman, which is very like writing a Rails app except that you compile the app into static HTML files. It's just so much easier to write in something like Markdown that gets generated to a nice page instead of having to edit the HTML by hand.
One rule : if you are building a quite complex website, you will spend plenty of time to do something (or many things) you could have done themn in seconds.
Writing websites from scratch is a student task/homework.

How to know where to use css, less and Sass? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I have knowledge of HTML, CSS, and jQuery. Recently I knew about Sass and less. As they both are the style sheet language I am a little bit confused about where to use both of them as CSS is already there and it is also widely used in every website. So how to know where to use these (Less, Sass) in that particular field.
Another doubt comes to my mind is, is it fine to use Sass and Less in wordpress instead of default CSS?
As zzzzBov said, LESS and SASS are css preprocessors.
Basically, you pick one and write your style definitions in that language. When done you run it through the preprocessor and it will generate a normal CSS file for you. That normal file is what you would use in your site.
I'd highly suggest that you skip using SASS/LESS or any other preprocessor until you are more familiar with CSS in general.
A little more information about LESS.
LESS can be run ahead of time as an actual preprocessor OR you can simply link the less.js file and your .less file and let the browser do it. The problem with letting the browser do it is that every single browser that hits your site, for every single page, will have to "recompile" the css in order to render your site correctly. Considering you have zero control over the computers hitting your sites this might result in a "slow" site from some peoples perspective.
Further, that javascript only works in some of the browsers, further limiting it's usefulness.
Quite frankly, CSS is one of those things that you generally set up once for a site and leave alone for a year or more. So, it may simply just not be worth it.
SASS and LESS are two Domain Specific Languages that are converted to CSS via a preprocessor. The preprocessor can run client-side in Javascript or server-side via PHP, Node.js, Rails, etc.
Either SASS or LESS would be excellent for a new project. Or if you're using a framework that makes use either technology. (Such as Bootstrap or Rails).
If you're modifying an existing web site which uses pure CSS (such as Wordpress) you should almost always extend and build off of the existing styles. Mixing plain CSS with SASS/LESS can be a mess especially if you are just learning the technology.
Both are here to make your job easier //save time, make your CSS more readable, you will no longer forget colors/margins or specific values that you used, because you can create variables, mixins etc.
If you feel like you would benefit from any of features provided, why wouldn't you use it? It's not mandatory to use those, it's not like I would use CSS for every project I create (majority though). Try it out, it won't take more than an hour to know basic features.

Any Best Practices for Project Structure in ASP.NET? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I'm working on a web application that is most likely going to end up with a large number of .aspx and .master files. The size is more a matter of scope than a design issue, so this is unavoidable. Are there any good/bad practices associated with the structuring of large projects?
Obviously I have separate directories for resources like Images, Script files, and Stylesheets, but would it be crazy to have a folder for master pages? If I know I'm going to have like 50 or 60 aspx pages, ought I to create a folder just for aspx resources? Taking that a step further, if 10 of those pages are going to be dedicated to a single product, would it be prudent to create a folder inside my aspx folder for ProductA or whatever?
Generally, the consensus seems to be that whatever makes it more readable to the developers (me, in this case) is good, and I know that Visual Studio does it's own thing when compiling anyways, but I've been in the shoes of the next developer to pick up a project so I'd like to avoid looking like a fool if I can. (not that I expect there to be a 'next developer' any time soon)
There's nothing wrong with creating folders for your master pages and product specific pages. It's simply a matter of preference (unless you have some crazy requirements for how the url should look).
For things like Master Pages, it's not so important - these aren't immediately visible to clients in and of themselves, so putting them in a subfolder is an organizational task which you are doing to help structure the site in your head, too.
However, for other fixed pages, the choice of folder can be important; for example, if you were to do the following:
http://www.mysite.com/folder/thing.aspx
You have now created a context for your page - the URL is, in effect, defining how that page sits in relation to your site. Further, this context can be used to your advantage in both navigation and search engine indexing.
A concrete example is a site that sells different categories of products; you could put things in subfolders like:
http://www.mysite.com/books/list.aspx - clear that this is a page that lists books
http://www.mysite.com/games/list.aspx - clear that this is a page that lists games
Search engines will then pick up on these categories and you'll be able to link to them in ways like:
http://www.mysite.com/games/ (providing you set a default page for that folder)
In effect, you are segragating your functionality by categorizing what that functionality involves. You are also establishing a semantic relationship between your site and 'games' in the example above.
This is a part of the REST methodology.
In practice, it is much easier to achieve this sort of structure using URL Rewriting which means, as another poster has mentioned, you don't really need to worry about the structure, except for your own organizational efforts.
It also means you can cut down on the number of pages, and, instead load user controls and content based on the URL you are passed.
So structure your files anyway you want, but do think about what your site's public face will be!
I'm assuming you're using asp.net webpage rather than mvc???
for your aspx files, I would put them in folders relative to the purpose the serve. You say you'll have 10 aspx files specific to products, so create a product or products folder and have those contained within that folder.
The folder structure for your aspx files will obviously control the path in the address bar, unless you're planning to do a bunch of routing.
I would definitely separate your master pages into their own folder for keeping things neat. if a master page is specific to a section of your site (ie: products) put it within the product(s) folder.
You can use routing with webform. this mean that you can do whatever you want right now and fixing it later on if needed. url wont change.
Obviously there's nothing wrong in separating pages and master pages by section/usage. However I'm wondering if you couldn't reuse more by using more User Controls, page templating and theming?

Is there any CMS that would lend itself to easily recreating this mockup? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I just finished creating a site mockup for a new version of our website. Our current site is hand written, and all content updates are code changes. I'd like to move our site to a CMS with as little custom styling as possible. Based on this home page mockup is there any CMS that handles this layout better than another?
#DougChamberlain I would personally divide all content by context; almost all blocks on the page would be derived from different files which were called into the home page template. The rest of the site may use a different template, but may still call the same blocks of content - This is a key part of why we'd design this way. This can be accomplished in any CMS; it's more a design principle than a feature these days.
For example, the red items in my overlaid mockup are includes, blue would be hardcoded, and green could be handled either way depending on your perceived uses for the content. Each include (red) would be a very generic php-html file, collecting data from different resources (Mostly your database) which could be adapted to different layout requirements.
Example of why we do this: You might design the search bar so that when you included it, it was inside of a container which could have the class 'longSearch' or 'searchBoxLarge' or 'searchBoxSmall' (Or whatever) which would dynamically produce the long search bar you've shown or a larger/small box to place in the right side of the footer perhaps. We'd design these included files to be very adaptable and reusable. Each time you include the search bar, it takes a single line of code (That's awesome), and each time it has an issue or needs an update, you only need to work on the file in one place.
Finally, all of these widgets, or components, or whatever you might want to call them, would live inside templates, which belonged to pages. Each page would have a set template (A blog style template, a generic content style template, a home page template, etc) which would accomodate the type of content that page was supposed to hold.
Any CMS is capable of this, but as I mentioned, WordPress is perfectly suitable, documents this layout method well, is free, and easy to learn with.
I apologize if my explanation here isn't what you were hoping for! I'm aiming to be helpful, but it can be difficult over the internet sometimes. Feel free to ask more or have me iterate over some points a little better.
A lot of variables other than just layout should play into choosing a CMS. One, what's the environment it will live in, windows or linux? Two, who will be the developers and what skills do they have? Three, who will be the content managers, developers, secretaries, other? Four, how easy is it add customization to it? And last, can I get my data back out easily if I want to move to another CMS?
There are literally hundreds of CMS's out there, and most do pretty much the same. They allow a template to be made, content pages be created off the template and the links for each page to be hooked up to another page.
Instead of just listing a huge amount of CMS names, just think of the above questions, answer them for your specific situation and then you should be able to choose a CMS which will help manage your content.
Good luck, and hope you find a solution that will work for you.

best jQuery AJAX multiple uploader [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Any suggestions?
Possibly something very interactive that I can multiple-select files. Thanks!
plupload - http://www.plupload.com/
supports multiple uploads in every type except basic html4
Allows uploads using HTML5, gears, flash, silverlight, BrowserPlus or plain on HTML4
Uploading files with Ajax isn't possible due to security reasons. There is a work-around with posting files to an iframe, but you can't select multiple files this way.
The solution lies in flash. The two most common flash uploaders are:
swfupload - http://swfupload.org/
uploadify - http://www.uploadify.com/ (jQuery only)
Another option is Uber-Uploader I have used it and it works well with a progress bar.
Or you could use the System.Web.UI.WebControls.FileUpload class in Asp.Net
At this point i'd stay away from flash plugins.
I'd use HTML5 uploader instead like this one:valums uploader
Sure - you'll be able to select multiple files in modern browsers only, otherwise - it'll be file by file. but hey - if person doesn't care about upgrading to newer browsers - they really probably don't know how to Ctrl+click anyways.
Flash doesn't send cookies correctly (it sends IE cookies even if you use firefox or google chrome). So - you'll lose cookies and thus sessions. There is a workaround - to send PHPSESSID in POST requests - but it simply opens door wide open for session fixation.

Resources