How to recognise when it is appropriate to code CSS [closed] - css

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I am working on a custom CSS file within a wordpress theme installation.
Within the CSS, there are times when I need to identify something like '.example', other times when it must be displayed as '#example' and other times when it is fine to keep it as 'example'.
Could someone please clarify the rules and how I can distinguish and decide for myself in the future which one to use in each instance?
This might have something to do with div ids and classes.

There is no 100% rule but generally:
An id must be unique, therefore any styles applied to an ID are only usable for the one element on the page. Therefore it usually makes more sense to style by class rather than ID because the mjority of the time you are going to want to reuse your styles. Additionally using an ID makes it harder to override the style later because id's hijack specificity.
I even take this one step further in that nothing should EVER be styled by ID but rather always styled by class. The one exception i occasionally make is for page-level scoping based on the id of the body tag. But even then a class is just as useful.
Id recommend reading up on OOCSS (note: i dont use any of the files used to illustrate the examples - im solely referencing the FAQ)

Related

Is this how CSS LESS and SimpLESS work? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I do a lot of front end work and was thinking of picking up CSS LESS, but midway through learning it, realized it may not work the way that I thought it would work and might not be able to help me as much. So I think below is how CSS LESS works, could someone who have used it just confirm please?
CSS LESS works using the SimpLESS compiler and makes the process of
initial css coding more easy with programming elements implemented.
However, before uploading the css code, it must be converted from the
dynamic .less format to the normal .css format and once uploaded to
the server, can only act as a static .css file.
Is the above correct? I ask because I work with a lot of wordpress websites and themes that already have the majority of their stylesheet created, and if I have to compile the .less format to .css format and reupload every single time rather than being able to use it as a dynamic pre-loaded library like jQuery, then I might not be able to get as much out of CSS LESS as I previously thought it would benefit me.
Both LESS and SASS are technologies designed to aid in the development and maintenance stages of creating CSS files; they work similarly to how Coffee Script is designed to work for javascript. In the end, however, LESS and SASS end up as CSS files just as Coffee Script results in plain old js files.
In any case, there are workflows that automatically handle compilation/save/upload of CSS files to prevent that step from taking extra time and work on your part, but no - browsers do not understand them by default. You can use javascript implementations as comments have mentioned, however.
LESS/SASS have their strengths, but making minor tweaks or customizations of existing themes and styles might not necessarily be one of them. This is not to say that you might not actually get a lot out of the technologies, but that is beyond the scope of your present question and would not even be something I am presently qualified to answer.

is the fist line comment css type declaraction still necessary? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
When I first started learning front end development I used to see the first line comment
/* css document */
or something to that extent, I can't remember what it was...
I haven't used it recently. Is it even necessary anymore?
Was that just a dreamweaver thing?
Could having your first line of css as a comment be dangerous?
CSS doesn't need any declaration like HTML documents do need DOCTYPES (well they don't need them but it's highly recommended)
Having a comment as first line in your CSS isn't dangerous at all. (In fact WordPress themes requires this, but that's something completely else)
You never have. From what I recall, the first line css comment was a, somewhat unnecessary, feature of dreamweaver at some point. Its only purpose was to remind the user that they were writing a css file, which was only necessary because dreamweaver would automatically save the document as .css if you clicked New>CSS File.

symfony2: pseudo locale (auto-)detection [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I have googling this for weeks now and i can't find a nice answer and uique way to do this.
I have a symfony2 application that is using FOSUserBundle. The app is available in different languages.
What i would like is to have an unique way to handle the locale detection. Since it has been moved from the session to the request i don't see a clear way to achieve that.
step a) user is not logged, maybe 1st time we saw it. Take the locale from the request header Accept-Language:en-US,en;q=0.8,fr;q=0.6 (for instance). Serve the user a localized version of login page
step b) user is now loggued in. of course we still serve him is prefered language based on the same header
So far i have done this using ResponseListner but it seems it won't work for the 1st request and have troubles with the FOSuser login page.
Any help with samples would be very appreciated.
LuneticsLocaleBundle is great for that: https://github.com/lunetics/LocaleBundle
It allows you to create a custom Locale Guesser:
https://github.com/lunetics/LocaleBundle/blob/master/Resources/doc/guesser.md

Hiding css files on WP [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Is there any way to hide css files on WP? I need to hide style.css file and file route.
Not only style but also need to hide other css file and their routes.
The fact is, any and all Style Rules are required to be either written directly to the document itself, or referenced in the head element in the form of a link tag.
There's no big secret to styling, so I'm not entirely certain why you would want to "hide" your stylesheet from prying eyes. Even if you were to create several hundred decoy CSS files and use cleverly placed #import rules to "confuse" somebody trying to find the actual filepath, what's to stop them from using a Web Inspector and seeing the active rules and the stylesheet in which they're contained?
Sorry to say, but you're pretty much going to have to deal with the fact that Style rules can be accessed by anybody.

Wordpress add new example? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I'm a bit new to wordpress plugin coding. I've been working on a plugin that will be very large, and contain many custom data structures.
I know this is a pretty general question, but I have a list of items (groups) on my options page. I'd like the entire options page to just use the settings api, but this list needs to have items added/edited/deleted from it. Does anyone have a good example of how to do this?
although I saw an exmple before - I can not remember where . But what I have tried to explain to you above is that first you need to add the elements using jQuery append like here : Dynamically adding HTML form field using jQuery then, for the options, just create an array, like here described here : http://wordpress.org/support/topic/dynamic-options .

Resources