All good things come in threes - doesn't always have to be!

CSS only - no JavaScript! Why JavaScript does not always have to be part of a website

It must be lean, cleanly programmed and free of unnecessary code - the source code of a website. 

It is the basis for the logic, structure and appearance of a page. Until all functionalities and the design harmonize, the code usually has complex interrelationships with different programming languages. SEO (Search Engine Optimizing) experts know what this means. If the code is programmed uncleanly or has components that are unnecessarily still part of the code, although you may not even see them on the website, then a poor ranking by the search engine follows. Many medium-sized to large companies therefore have SEO experts who constantly deal with the question: What are the next steps to improve the ranking of our company website and how do I operate the most effective search engine optimization?

CSS, HTML, JavaScript - a brief explanation 

HTML is the short form for Hyper Text Markup Language. HTML is based on the XML data format and is, in this sense, only the framework in which all the components of a homepage are located that are displayed in the browser. This includes the structure and content of a page. Headings, images, the navigation, as well as interaction elements such as buttons, links and forms are elements that are defined in HTML and can be used to create web pages. HTML itself has a syntax that is recognized by the browser. The browser then displays the elements correctly. In combination with JavaScript and CSS, web applications, mobile apps and much more can be created. 

CSS is the abbreviation for Cascading Style Sheets and defines the design and formatting of an Internet page. CSS determines the appearance of HTML documents, such as the font, colors, width and height. The elements have a unique designation, selectors, such as an ID (identification), a class or a type. The element can be addressed by this designation. The element selectors possess thereby agreement regulations, which consist of different kinds of the element selectors. The specificity is the basis on which the browser decides which CSS property values are most relevant for an element. This is then applied. In this respect, specificity is a weight given to a particular CSS declaration. If multiple declarations have the same specificity, then the last declaration found in the CSS is used for the element. This specificity is only needed if the same element is addressed by different declarations. In CSS, directly selected elements always take precedence over elements that inherit their rules from a parent element (ancestor). If the "!important" addition is applied to a declaration, it always takes precedence. 

JavaScript (JS) is a programming language that is interpreted by the web browser, translates processor instructions and is then executed on the user's computer. This is also the reason why this is referred to as a client-side programming language. Here JS has access to the HTML document, as well as the browser window and executes tasks. In detail, this means that a user interacts with an element of the page and JS reacts to exactly this user input. JS can thus make changes, such as entering the email address in a form. This change takes place in the computer's memory and not directly in the web server's document. Thus, JavaScript functions can change content and also the presentation of a document. 


All these markup languages are necessary to create a page and make visitor interactions as user-friendly and simple as possible. In principle, this approach is right thinking, because many elements of a page, such as a global search on a page, require a JavaScript function for proper use. 

But why then "CSS only" and "no JavaScript"?

Use cases arise time and again where an implementation does not necessarily require the use of JavaScript. If a user interaction with a page does not require a major change, such as changing the appearance of an element or overlaying a text passage with a different looking text, then this can easily be implemented with CSS. 

In doing so, an element can be hidden and a differently styled element can be shown again in exactly the same place. For the user, this creates what appears to be a real interaction with the homepage. Technically, however, only a style change of the element is made. 

Why is this approach good?

From a developer's perspective, the complexity of the code can be minimized. In some cases, the composition of the three aspects HTML, CSS and JavaScript can be optimally reduced to two. 

But from a search engine optimization perspective, this approach also offers three key advantages. On the one hand, the reduction in complexity means shorter loading times, and on the other hand, a lean and simple code plays an important role in search engine optimization. The security of the code is also increased as a result.


Which program base a page should have depends on the situation. However, it is worth taking a closer look. Optimizing your own site is a constant process that never ends.

Contact us
We are happy to support you with optimizing your website
Get in contact with us
Request a Case Study