Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
1answer
41 views

ReactJS - proper way to handle a responsive design approach?

I've always used CSS and media queries when it comes to responsive design. I've been developing in ReactJS for a while, but I feel my approach to responsive design is sloppy. I find myself using a mix ...
2
votes
1answer
80 views

How to white label my website in php

I have a website that follows the following structure: www.example.com/city1 www.example.com/city2 ... Programmatically we change the logo which is hard-coded in a specific config file for city 1, ...
3
votes
2answers
114 views

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....
0
votes
1answer
124 views

Is there a rule of thumb when it comes to the “name” attribute?

Since there is things like BEM in naming conventions for HTML class attributes, does the name attribute have anything of that sort?
-2
votes
1answer
111 views

Can everything that CSS Grid or Flex Box do be done with older CSS properties?

Can you do everything that CSS Grid or Flex box does with properties such as display, float, margin, position, overflow, etc ? Edit: See my comment with @PeeyushKushwaha
1
vote
0answers
41 views

Is CSS Grid a superset (in practical terms) of CSS Flexbox?

Note: this question is about the practical aspects of a language. I am not sure it is suitable for this site, apologies if this is not the case. I am loosely writing client (front-end) code to be ran ...
1
vote
3answers
101 views

If either html+css or an image can achieve my desired decoration, which one should I prefer to use?

For example, to create flow indicator like: Step 1 > Step 2 > Step 3 I can either: 1.Use html+css .concave{ border-left:1em solid transparent; border-top:1em solid orange; border-...
0
votes
2answers
168 views

CSS Methodologies for a Few Classes

We've been using BEM for several Drupal CMS projects quite successfully. This means we've been following a frontend-first approach where frontend developers specify the HTML, which is then implemented ...
4
votes
1answer
392 views

Is CSS inspired from C? [closed]

Maybe I'm not the first to ask this, but I've searched up and down the stack and I am yet to get an answer to my question. I have learnt CSS, and I also have a basic idea of the C programming language....
-3
votes
1answer
86 views

Is there a best practice for naming class selectors for identification alone

Is there a best practice for naming class selectors for identification alone? For example, for defining a single amount field with action button, we end up creating several div containers and div ...
1
vote
2answers
188 views

Do I need to put a license in my website's HTML and/or CSS?

I am making a website for a competition my school is taking part in, however I am not on the team and am not receiving any compensation (save for better references :P). The only condition I have set ...
0
votes
1answer
150 views

Using CSS classes to express state

Is it good practice to express the state of an HTML element--such as whether an input's value is valid--using a CSS class? Would it be better practice to use data attributes, the properties of a ...
-3
votes
1answer
193 views

What does it mean by Don't use IDs in selectors? [duplicate]

I was just trying IDs on the CSS tab and I noticed that a little warning sign appeared "Don't use IDs in selectors" Why does the CSS tap recommend me not to use IDs in selectors?. Is there something ...
1
vote
1answer
77 views

Styling shareable React component?

I've been looking for a good way to style a react component just using css stylesheets. I would have used style-loader, because it's as easy as require('./style.css') and allows to save the final ...
5
votes
0answers
707 views

Best Practices For Writing Memory Efficient CSS

What are some best practices for writing memory-efficient (for the lowest peak memory usage) CSS? I realize this is a broad question, so I have broken it down into two main categories: What are 'do's ...
2
votes
3answers
140 views

Add extra HTML classes for frontend-tests?

Imagine a structure like this, a list with products. <div class="container"> <div class="teaser"> <img src="..."> <p>Product 1</p> </div> ...
7
votes
2answers
2k views

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 ...
6
votes
2answers
1k views

Why does Facebook obfuscate the names of CSS classes?

If you look at the source code of a website such as Facebook, you'll see many classes as such: <div class="_cy6 _2s24"><div class="_4kny"><div class="uiToggle _8-a _1kj2 _4d1i _-57 _5-...
0
votes
1answer
130 views

load more and Search Logic

Firstly i hope im in the right place to ask this question. I am building a web page that allows the user to select one image from a set of a 100+. i want to display them 6 at a time and the user ...
0
votes
1answer
173 views

Custom CSS Framework

Context: We're having a ton of super heated debates around the office. I'm just a neutral observer, as this is my first month at my current employer. Previously I haven't ventured outside of the ...
1
vote
2answers
151 views

Tabular Website Design with Continuously Added Content

I'm currently working on a site for a friend, converting a google sheet to a webpage (to reduce the time it takes to modify the spreadsheets and apply them to all users). One particular page is ...
2
votes
0answers
245 views

React DOM manipulation vs CSS for responsive breakpoints?

Specifically for ReactJS and responsive frameworks that show/hide elements based on width like Bootstrap. Because ReactJS has a virtual DOM I am presuming doing the DOM manipulation is faster and in ...
4
votes
0answers
71 views

Bootstrap classes in SCSS or HTML?

If I had a development workflow that supports SCSS and uses bootstrap. I can place bootstrap tags two ways... Inside the HTML: <div class="col-sm-3 offset-sm-9 col-xl-1 offset-xl-11"> Part of ...
4
votes
3answers
593 views

Best practices for front-end project with many views

We are a small front-end dev-team working with 18 months of experience and recently we got in touch with a first major project, ie. a medium complexity back-office web app, but with lots and lots of ...
1
vote
1answer
422 views

What are security risks of WYSIWYG HTML/CSS/JS editors running as web service?

I am currently implementing WYSIWYG editor that will be available on the web, what are the main security issues I should tackle? The editor currently works that when user is done typing, the text gets ...
4
votes
1answer
120 views

Why to design for mobile and scale to desktop with media query?

In the W3schools tutorial on CSS3 media queries they recommend to have the standard layout adapted to mobile viewing, and have a media query "scale it up" to desktop format when viewing on a desktop ...
6
votes
1answer
107 views

sass - use abstract selectors or mixins/placeholder?

This might have been covered in another thread. I didn't find it though.. Today, with Sass I have 2 options of styling my website. Lets see examples Example 1 <button class="button main center"&...
15
votes
2answers
637 views

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 ...
8
votes
2answers
2k views

Should minified CSS be stored in Git?

I use Gulp to generate minified CSS from my SASS code for a project I'm working on. I wondered whether it's considered best practice to regenerate this minified CSS when pushing live from Git... or ...
7
votes
1answer
307 views

Why CSS3 Basic Box Model is “Dangerously outdated”?

These days I'm learning CSS by reading specifications, but I noticed W3C marked CSS Basic Box Model Level 3 as "Dangerously outdated" without any further explanation. So my question: What's the ...
12
votes
3answers
874 views

Why doesn't CSS allow single-line comments? [closed]

I understand that CSS only supports multi-line comments like such /* foobar */ Why is there not support for single line comments. // foobar They are just as common in programming and seems ...
1
vote
0answers
776 views

Bootstrap components and SMACSS/BEM methodologies

I have no enough experience in web development and I need advice from more experienced developers. I have been exploring SMACSS and BEM methodologies for a few weeks, and I like them, it makes really ...
2
votes
1answer
142 views

Using relative units instead of px following DRY principles

I am relatively new in web development, but I am trying always to find the best way and make my code even CSS and HTML clean. So I've started exploring best practices. First of all lets start ...
-5
votes
3answers
221 views

Put all libraries (bootstrap…) in one file at the end of development

One of my coworkers puts all the css files in o one lib.css in the end of the project. I hate it because when i need to change something its just bad the see which scribt is involved (i see its in lib....
1
vote
1answer
79 views

Frontend end UI Library using multiple repos for multiple clients

I've just inherited a HTML/CSS based internal UI library, which the place I work is planning to use to standardize CSS styles for all of its products across the board, mainly webapps. The library has ...
3
votes
3answers
2k 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 better ...
1
vote
1answer
402 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
604 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="...
62
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
297 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
124 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 ...
9
votes
4answers
3k 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
939 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 ...
-7
votes
2answers
146 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....
4
votes
1answer
856 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
89 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
4answers
690 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
738 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 ...
2
votes
0answers
100 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
368 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, ...