Questions tagged [css]

Cascading Style Sheets (CSS) is a language for specifying the layout and presentation in general of markup such as HTML and XML.

280 questions
17
votes
2 answers

CSS for Visually Impaired people?

So while I was learning HTML I encountered CSS. It's interesting because with CSS you can make a webpage cool or more beautiful. But since it's more about colors, designs, styles etc., I can't know the results of my CSS codes. As someone who is…
16
votes
2 answers

Are ems still relevant?

My understanding from reading threads like this one is that the point of ems is to define all measurements in your webpage, by the base font size, which can be set by your browser. For example, in Chrome you can do this by going settings -> show…
dwjohnston
  • 2,553
14
votes
2 answers

How to namespace your CSS?

As far as I know there are two types of CSS namespacing: Prefix one: .myapp-alert {...} and class one: .myapp .alert {...} Which one is preferable? Does one has benefits over the other one? Are there any other?
Runnick
  • 205
7
votes
7 answers

How to organise Website CSS

I understand the concept of CSS. But on many projects I've found that I tend to lose myself and end up with a millions CSS files for a millions different pages! I realise that the point of CSS is that it cascades. Otherwise it would just be a style…
7
votes
3 answers

Multiple style sheets best practice

I currently am working on a project which has one large style sheet for about 20 pages. The style sheet contains some styles which are specific for certain pages. I'd like to break the style sheet up so there is one style sheet for each page with…
6
votes
3 answers

Naming CSS classes and IDs

I'm quite a CSS beginner. I've read some introductory books but now I came across a sort of question that isn't answered in any of them: Let's say I have a basic HTML-based website with a standalone CSS file. Now I'm creating a new CSS class or ID…
Jeyekomon
  • 171
6
votes
3 answers

What is the best way to construct your CSS documents?

Normally I start a project working on a site, I'd do the basic html skeleton and then start tweaking the styles using CSS. Slowly I'd just add one CSS rule after another with no "organized structure" or groupings in the CSS rules. And at the end of…
5
votes
3 answers

CSS practices: negative positioning

I'm somewhat of a novice to CSS. Anyway, I noticed that an extremely common method used in CSS is to have negative or off-screen positioning, whether it be to hide text or preload images or what have you. Even on SE sites, like StackOverflow and…
Corey
  • 1,812
5
votes
2 answers

How do web developers deal with editing (pre-processed) vendor prefixed CSS in browser dev tools?

I have a dillema working with CSS. I use a pre-processor to add all necessary vendor prefixes to CSS when it's served, keeping my source code short and simple. However the issue is, by far the most effective way to to edit styles realistically (and…
J.Todd
  • 3,823
4
votes
1 answer

Which CSS attributes should be in HTML and which in BODY?

I have the following: html { overflow-y: scroll; } body { font-family: Georgia, "Times New Roman", serif; font-size: 1.125em; line-height: 1.5em; margin: 0 auto; max-width: 41em; } Which attributes should be with the HTML section, and which within…
3
votes
2 answers

What are CSS modules? Are they a library, or a spec, or what?

So there are a fair few blog posts about that introduce CSS modules. For example: the official documentation: https://github.com/css-modules/css-modules a post from CSS Tricks: https://css-tricks.com/css-modules-part-1-need/ These show us the…
dwjohnston
  • 2,553
2
votes
3 answers

CSS: When to use which selector

I've been learning HTML5/CSS3 for a month now, and I've built my first demo website. At first I was using a lot of the element selectors like: >, ,, + in combination with the type names for selecting nested tags. Now I've moved more to the id and…
supercell
  • 1,527
  • 3
  • 12
  • 11
2
votes
1 answer

Sass File Formating - what problems might are there with the following rules?

For a while now I have been considering the formatting of sass files to maximise their usability by other coders and I think that this would be perfect place to get some feedback on the rules I try to apply when writing a sass file. I am…
1
vote
2 answers

Can you reference one data value by a name throughout a stylesheet?

For example, I'm changing color pallettes throughout a site i'm coding and would love it if i could reference that color somehow instead of replacing the hex value for every item. I know the following doesn't work but i'd like something…
Jephrei
  • 13
  • 3
1
vote
1 answer

When is background-image not wrapped in: url();

In CSS you declare a background-image by wrapping it inside a url('') ... is there an example when you don't need do this and if not why does it even exist? Even when you're using base64 you still wrap it in a url and I can't seem to find a…
Kevin S
  • 113
1
2