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

-3
votes
0answers
19 views

Mobile devices and their screen resolution [on hold]

I have used and if statement with document.write(screen.width + 'x' + screen.height); There must be a better way like knowing the type of device and then moving them to a custom website. Does ...
0
votes
1answer
48 views

Starting Java 2016: FXML and CSS and SceneBuilder

I have past experience writing Java with Swing, and I need to get up to date and write an application using JavaFX. I do not have a background in CSS, and I am wondering about what level of ...
-3
votes
0answers
24 views

Positioning two unordered lists one - below-the-other, as a preparation for dropdown navigation [migrated]

I have been struggling really long to position the lists properly. My current code is: <!DOCTYPE html> <html> <head> <link rel="stylesheet" type="text/css" href="css/style.css"&...
1
vote
3answers
177 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
61 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
2answers
232 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 id="...
58
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
198 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; font-weight:...
2
votes
1answer
119 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
158 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)
14
votes
3answers
316 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 m.site....
1
vote
1answer
148 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
56 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
66 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
177 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
56 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
87 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
148 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 Bootstrap,...
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
74 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
164 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
42 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
89 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
573 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
901 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
192 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
326 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
72 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
244 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
69 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
75 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
372 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
162 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 ...
178
votes
8answers
66k 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
132 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
72 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
3k 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
99 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
908 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
121 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
368 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
597 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, ...