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

learn more… | top users | synonyms

1
vote
2answers
84 views

Why is it bad to use inline styling in HTML for generic styles?

Given <div> <textarea></textarea> </div> Why is this <div> <textarea class="width90"></textarea> </div> .width90{ width:90%; } any ...
1
vote
1answer
56 views

Client wants browser's back button to work on a website doing AJAX calls

I'm currently working with a client's website in which we are using ajax calls to show the content of the pages, we are doing this in a single div and obviously you don't move from the index. My ...
-2
votes
0answers
19 views

Why is the UL element not visible? What is wrong with my code? [closed]

Below is the code <style> ul {list-style-type:none; background-color:#000; } li {float:left;} li a {background-color:green; color:white; padding:15px; ...
2
votes
2answers
228 views

Are there any reasons not to ever use classes or ids anymore?

I sort of understand unobtrusive javascript. Even in my CSS now I hardly ever use classes or id's because I like clean, easy to read, uncluttered html files. For example, why use this: <body ...
57
votes
5answers
7k views

Why are large amounts of magic numbers acceptable in CSS and SVGs?

Often times I see questions on the Hot Network Questions list like this that basically ask "how do I draw this arbitrary shape in CSS". Invariably the answer is a couple of blocks of CSS or SVG data ...
2
votes
1answer
195 views

Why does nobody use indentation in css? [closed]

I find css quite hard to read sometimes. Indents, depending on the dom structure, would greatly increase readability. Consider the following example: #page { text-align:center; ...
2
votes
1answer
118 views

When making a change to a single table in our app, should we minimize the scope of our change, or follow best practice for css/jsp coding?

My co-worker has been assigned the task of editing one of our Java application's tables. She is almost done, but needs to make one final adjustment to the table - this requires her to add a CSS ...
2
votes
2answers
150 views

Why does :nth-child() in CSS start from 1 instead of 0?

Why does :nth-child() iterate from one instead of zero? As shown in this example. Why does it select the first element and not the second when p :nth-child(1)
12
votes
3answers
297 views

Providing Local JS and CSS Resources for CDN Fallbacks

Given that CDNs are a Good Thing because they can serve resources closer to the client, the client can cache them, and you can reduce load on your own server. In recent browsers, loading resources ...
-5
votes
2answers
90 views

How do I make such a page that opens different link in web (PC) and different in mobile (phones)?

I am building a website that looks beautiful in Web but worst in mobiles. I want to build the same site but different designing for mobile. Whenever user opens site.com then it auto redirect to ...
1
vote
1answer
142 views

What is the reason that CSS variables are defined using two hyphen characters (--)?

CSS variables supported natively it's a powerful feature to develop complex web apps without some additional step as preprocessors. So, this is fantastic. But (at first) the syntax of defining ...
0
votes
2answers
52 views

PSD to HTML/CSS limitations when using Twitter Bootstrap

How do companies deal with limitations and constraints of Twitter Bootstrap after choosing to use it in a particular project? Web designers are no longer free to design Web pages. They need only to ...
0
votes
3answers
65 views

Overwriting Bootstrap CSS classes

We have an Angular JS app for which we use Bootstrap CSS. We are currently using pure Bootstrap with the default CSS files. However, we need to style the app in my companies corporate design sooner or ...
3
votes
3answers
170 views

How is rendering a Word document different from rendering a website? [closed]

Now, it doesn't necessarily have to be Word — for ease of comparison, let's use ODT, which is based on XML — which is pretty similar to HTML. That would, to my mind, make rendering an ODT ...
1
vote
0answers
55 views

How can I properly classify elements?

I'm writing a webpage with a simple header, nav, body and footer layout. To style it, I wrote the following CSS: .mainSideBar { position: relative; display: inline-block; vertical-align: ...
5
votes
1answer
81 views

Finding the smallest sub-collection of sets that intersect to produce one element

I came up with a problem that's similar to the Set Cover problem but which I can't reduce down to any know problem. Does anyone have a good algorithm for solving this? Given a set of elements U = {1, ...
0
votes
1answer
139 views

How can I use a framework like Bootstrap when I already have designs from a design team [closed]

We are about to start an AngularJS project. In fact, the CMS will be AEM (Adobe Experience Manager). I'm now looking into the CSS/layout framework, and whether its worth using something like ...
0
votes
1answer
46 views

When to use CSS pseudo-elements? [closed]

::before and ::after are CSS pseudo-elements which allow stylesheet to specify the content. Apart from html usually specifying the content, When do I think of using these pseudo-elements?
0
votes
1answer
73 views

How do browsers do CSS caching and why only .alert or .danger but not .alert.danger? [closed]

I read about BEM & OBCSS here and somewhere the author mentioned this: Decoupling selector will not only increase maintainability and scalability: it will speed up the rendering. Most web ...
5
votes
2answers
95 views

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

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 ...
3
votes
3answers
155 views

Is the `<table>` tag and `display:table` a functional or a layout directive?

Background I've always disliked the idea of using the CSS property of display:table. Using it feels like an ugly hack and I always prefer to use a direct <table> tag instead. Of course, I use ...
1
vote
0answers
41 views

Responsive design - up to a point - and then an alternative layout

I am using AngularJs. I am unsure whether this is a pure CSS question, or needs some JS to handle logic. Let's say that want to display a grid full of numbers - and some sort of histogram or other ...
1
vote
2answers
87 views

Any benefits of splitting web project stylesheets?

Regarding the fact that C in CSS stands for Cascade, so generally speaking rules described in one file can modify/subsitute rules in other files, can we claim that all project css files should be ...
0
votes
0answers
529 views

Starting off with Grunt in an eclipse webapp project

I've been developing a webapp for some months now using struts2, jQuery and sitemesh to decorate my pages (JSP's mostly). My dependencies are managed by Maven and I've had a fun time learning as I'm ...
0
votes
2answers
831 views

Selenium Testing w/ dynamically generated element id's: XPATH or CSS selectors?

Background: I'm an intern tasked with learning Selenium; my organization plans on having QA/Testing use it to simplify testing. We use JSF and WebSphere Application Server. One of the persistent ...
0
votes
1answer
36 views

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

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 ...
0
votes
2answers
182 views

How can I show and hide a single field across my web application through a checked value?

Let's say I have a field called "FooName" and I have "FooName" in several places across my web application (ASP.NET MVC4). I have a check box that allows me to turn "FooName" on and off across the ...
6
votes
1answer
323 views

“CSS first” vs “HTML first” (Bootstrap, SASS)

Kind of a follow-up to Should I write HTML or CSS first? On a relatively large website, we are considering to use SASS and/or Bootstrap. From previous projects, there seem to be different ways to go ...
4
votes
0answers
68 views

Conditional CSS based on external modifier class - good practice?

Introduction / background: CSS components For a relatively large website we are working with SASS, and trying to manage CSS in components. The basic idea of components is that a component should look ...
-3
votes
2answers
228 views

In HTML and CSS what are the standard tab sizes? [closed]

I searched on Google but couldn't find an answer. I'd like to know what are the standard tab sizes for HTML and CSS. Is it 2 or 4?
2
votes
1answer
68 views

Bundling and minifying options for MVC2

I've just been handed an MVC2 application and noticed that there is no bundling or minifying of the JavaScript or Stylesheets. I've used the built in bundling and minifying logic that comes out the ...
0
votes
1answer
74 views

Sense user-agent to determine HTML - Keep HTML and Logic separate?

I am of-the-understanding that you should try to keep HTML out of your logic, and keep logic out of your HTML. E.G.: You don't write HTML in (C# strings or Javascript Services) and pass them into the ...
2
votes
2answers
355 views

Pre-Processors vs Pure Web [closed]

It seems like within the last few years or so HTML/CSS/JavaScript Preprocessors have exploded in quantity and general use. They're still not as common as pure HTML, CSS, and JS/jQuery, but their ...
-2
votes
1answer
161 views

How do I customize Bootstrap? [closed]

I am a desktop programmer but currently I am trying to develop a website. I know HTML, CSS, Javascript and PHP but writing the complete code from scratch isn't encouraged and well, I end up with weird ...
5
votes
3answers
1k views

What makes BEM better than using a nestable style sheet language like LESS?

A colleague of mine is heavily pushing the BEM (Block Element Modifier) method for the CSS in a project he's helming, and I just cannot comprehend what makes it better than the LESS CSS we've been ...
1
vote
1answer
102 views

Multiple CS Sheets or Javascript

I have a homepage with a navigationBar on top of the Viewport contains two buttons. One is the default selected home button which calls/displays home.html. The other for example is Ubuntu which calls ...
170
votes
8answers
62k views

Why are people making tables with divs?

In modern web development I'm coming across this pattern ever more often. It looks like this: <div class="table"> <div class="row"> <div class="cell"></div> ...
2
votes
2answers
123 views

Where to put css media queries in a CSS file?

Where to put CSS media queries? everyone after related element (class style) or gather them at the bottom of CSS file? which one is standard? or which one do you prefer?
1
vote
1answer
71 views

Is it OK to replace html on resize?

I was asked to take over a web project. It is supposed to be a responsive website, but the former programmer didn't write the HTML/CSS with responsivity in mind and adding code to make it responsive ...
2
votes
7answers
2k views

What to use instead of IDs in selectors in CSS

I recently installed a csslint package for my Atom text editor. I keep getting warnings saying "Don't use IDs in selectors." I found this weird since I've always been using IDs in selectors in CSS, ...
9
votes
4answers
4k views

Why is it (or was it) important to separate CSS from HTML? [duplicate]

Intro I recently watched the slides from React: CSS in JS and I really like the idea of having CSS applied using JS (and with JSX, this would mean having all the HTML, JS and CSS in one file, which ...
3
votes
1answer
98 views

SASS placeholders to avoid repeated rules in CSS output

I've got a question for all the frontend guys here. First of all, this is not about placeholders vs mixins as I've already have an idea about, whether to use one or another. So the question is - do ...
1
vote
3answers
872 views

Conceptually, is the single page web app more efficient than the web app that loads pieces of the page for every page? [closed]

I searched a lot, but nobody seems to have explained this nor given a proper example. I have a page like this: My team says they want to design the code such that the Title section, Menu ...
1
vote
3answers
120 views

Linking stylesheets and scripts when using server side includes

I am working on a site where I want to have a header and footer on each page, so I thought about using server side includes for this. I have not used them before so I am a little bit unsure about best ...
1
vote
2answers
341 views

Do I need Bower for front end dependencies when I am already using composer?

I use composer for PHP dependencies. I was under the impression that for front end dependencies I should use Bower. So, I installed Bower and loaded my FE dependencies (Bootstrap, jQuery) using that. ...
2
votes
1answer
132 views

Sacrificing readability for shorter compiled code

I'm currently revisiting some code I wrote in sass when I was learning it and I came upon a particular issue. I was able to write the code in 2 ways, with the first being the more readable code and ...
1
vote
1answer
557 views

Is it okay to use CSS3 with HTML4?

Is it alright to use CSS3 with HTML4. It seems like CSS3 would be a HTML5 complaint deal. But I'm not sure if that's the case. If it's not okay, what are the downfalls to using CSS3 with HTML4, ...
11
votes
0answers
226 views

Math model for a webpage layout? [closed]

While web-programmers surely know CSS/HTML rules by heart, and web-browsers have algorithms to render web-pages, what interests me whether there are any mathematical/theoretical models or at least ...
0
votes
3answers
120 views

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 ...
0
votes
2answers
810 views

How to best do cross-browser cross-platform visual CSS regression testing? [closed]

Background: Visual CSS regression testing is where you screenshot (part of) one version of a webpage in a browser and compare it against a screenshot of the previous version of the same webpage in the ...