Tag Archives: html

Myths and Realities of Replaced elements in HTML

Replaced Elements in HTML Myths and Realities - YWF (2)

According to official specs, replaced elements are content outside the scope of the CSS formatting model, such as an image, embedded document, or applet. For instance, the content of the HTML IMG element is often replaced by the image that its src attribute designates. Besides, replaced elements often have intrinsic dimensions, such as an intrinsic width, an intrinsic height, and an intrinsic height specified in absolute units. Now, you may have a general description of what a replaced element is, but as a web developer, you have to look deeper about replaced elements.

Replaced Elements in the Real World
To discuss in a full description about the replaced elements, we need to go to a different resource, namely the Rendering section of the HTML Living Standard document. But, when you look deeper, the specs can be confusing. This is because some HTML elements operate as replaced elements all the time, while other do it only in specific circumstances.

Embedded Content
Embedded content is the first category of replaced elements. Embedded content means any element that imports another resource into the document, or content from another vocabulary that is inserted into the document. While these external resources have the intrinsic dimensions that match the requirements of the definition.

Embed, iframe, and video are the main elements in this category. Since they always import external content into your document, these elements are always treated as replaced elements. There are more elements that a bit more complicated that fall into this category only in special circumstances, such as:

  • applet – Treated as a replaced element when it represents a plugin, otherwise it’s treated as an ordinary element.
  • audio – Treated as a replaced element only when it is “exposing a user interface element”. Will render about one line high, as wide as is necessary to expose the user agent’s user interface features.
  • object – Treated as a replaced element when it represents an image, plugin, or nested browsing context (similar to an iframe).
  • canvas – Treated as a replaced element when it represents embedded content. That is, it contains the element’s bitmap, if any, or else a transparent black bitmap with the same intrinsic dimensions as the element.

Images are others elements that treated as a replaced element with the intrinsic dimensions of the image. This category also includes the input elements with a type=”image” attribute.

When the image is not rendered on the page, things get a bit more complicated for several reasons. The <input type=”image”> will be displayed as a normal button.

Default Size of Replaced Elements
We can understand this elements by these three basic rules:

  • if the object has explicit width, height and ratio values, use them;
  • if the object only has ratio, use auto for both width and height while maintaining the said ratio;
  • if none of these dimensions are available:
    – use width: 300px; height: 150px when the viewport is larger than 300px
    – use “auto” for both width and height and a ratio of 2:1 when the viewport is smaller than 300px;

What About the Other Types of Form Controls?
There are many misconceptions about other types of form controls are replaced elements too. After all, these elements are also rendered with a default width and height. In fact, most people consider intrinsic dimensions actually comes from the following line:

Each kind of form control is also described in the widgets section, which describes the look and feel of the control. Another reason why form control looks different from one browser to the next and from one OS to another:

The elements defined in this section can be rendered in a variety of manners, within the guidelines provided below. User agents are encouraged to set the ‘appearance’ CSS property appropriately to achieve platform-native appearances for widgets, and are expected to implement any relevant animations,etc, that are appropriate for the platform.

It is easy to get confused about replaced elements and form controls. But, they are different categories of HTML elements, with <input type=”image”> being the only form control that is a replaced element.


3 Techniques on How to Optimize Your Website for Multiple Keywords


With so many updates, nowadays SEO puts more priority on context. This makes context is above keywords. But, this doesn’t mean that you will neglect keywords relevancy and authority. Therefore, as a SEO engineer who works for SEO service, you have to understand and combine what Google wants and what users want.

If you assume that Google will understand the context of your content while you build a strong brand and positive user experience, you will still have to consider about the hierarchy of your content, how to organize it, and how to build context that can rank for multiple keywords, so that it will meet your conversion goals. Below are several tips on how to optimize and focus on keywords.

  1. Know Your Current Content

After determining your conversion goals, you may need to set your analytics house, and conducted keyword research, then you’re ready to organize your keyword data into meaningful topics. Instead of stemming or use all of the literal variations of the terms and its plural or singular versions, you can find sets of terms on the same topic and group them together.

Usually we often fall into the most general topics of the niche or industry when running an e-commerce site. Most B2B sites follow a pattern as well with top-level business industry terms, product or service categories and the products or service themselves.

As keywords grouped into topics, so it is possible to take the important next step of mapping your keywords to existing pages of content or conducting a content audit. As the first step you can run a crawl of the existing site structure with screaming Frog, download the HTML page results into Excel, and then get to work putting topics and terms out to the side of specific pages.

When you know you have content gaps and need to create more, that’s when you can turn around and quickly search to see which websites own the top of the SERPs for those topics and draw inspiration (without copying them) for ways to fill the gaps with your own content and draw inspiration for ways to fill the gaps with your own content and make decisions based on priority.

  1. Optimize Site Architecture

Even though, you can start once you know where you stand with content, then having a plan for filling gaps but first you need to figure out how to organize the content. This means balancing user experience, with product/service offerings and topical keyword search volume. Moreover, build out your site hierarchy working top to bottom going from most general to most specific. Even though, mostly sites are already built this way. However, site navigation and structure is often dictated by an internal or organizational view when SEO isn’t involved.

Besides, you are able to cast a wider net in terms of rankings and visibility, by taking an approach that looks at essentially any page at any level on the site as an entrance point and landing page for one or more topical keywords. In fact, all of your efforts will destruct your message, when you try to rank for too many terms with a single page or section of the site.

  1. Do Your On-Page Optimization

It is surprising that there are so many SEO campaigns that neglected the basics of on-page optimization. In fact, these SEO basics still apply. However, you need to look at it deeper than just trying to merely produce content and organize it well top to bottom in the site. Besides, you need to ensure proper categorization, when you’re building context for the user and Google. Another power in the on-page variables is having all factors working together with architecture and on-page optimization.

Things that can be cached in WordPress Cache

WordPress Cache What can be Cached and How We Do it

Caching is one of technologies which can contribute to site speed. Besides, caching will enable your stored data to be available for future requests. Some web developers might be familiar with it, some might not. But, if you haven’t been familiar with caching, you can learn more about it in this article. This article will explain what WordPress cache is and how it can be implemented on many different levels.

What is Caching?
In computing, the word “cache” is quite familiar. It refers to software or hardware component which is temporarily used to store values and retrieve them faster in the future. Values include MySQL queries, or compiled PHP bytecode as well as duplicate data, such as HTML and images.

In fact, we can gain a significant performance advantage by making copies of data and placing them in the “caching” component. This is because your visitors can retrieve cached content much faster than un-cached. Besides, your performance improvement can enhance depends on how much data that you can cache.

Things that can be cached
There are several levels, depending on how far you want to go in optimizing your website using caching. Here they are:

  • HTML Output
    You can find many plugins that can help you cache the HTML page itself. For instance, you can use WP Rocket and W3 Total Cache that can perform cache and many more. These plugins cache the result of the HTML output saving time for future requests. In fact, you can serve uncached content for every plugin have a cache invalidation mechanism.
    You can also try to “minify” HTML to make it smaller. This will add up a couple of kilobytes per page and keep increasing over time.
  • PHP OpCache
    A technique which PHP takes the source PHP files and compiles them into an intermediary form called bytecode is named OpCaching. Bytecode is like a computer’s machine code, but it refers to machine code that is executed by a “virtual machine” rather than by a real one. Fortunately, it can be executed quicker than having the PHP interpreter parse a command at a time since it is machine code and resides in memory.
    At a certain level, caching stores these bytecode data into memory, this causes your application gets executed faster. Besides, in order to have PHP OpCache enabled, you need to have access to the PHP configuration file.
  • PHP Object Cache
    This cache is done on the language’s OOP level. It uses the concept of “objects” to describe logic, data, and ideas. Objects are constantly being created and destroyed as your application runs. This technique solves the problem by caching the objects themselves.
    You can find PHP object cache in Memcached and the assorted ones for Redis. However, in order to enable PHP Object caching, you need to have access PHP configuration.
  • MySQL Query Caching
    The idea might be the same with PHP object cache, unless it is applied at a database level. A set of data are returned by the database based on the query that was entered. In fact, someone can get data much faster if someone has called the same data first. This is because they would reside cached in memory. But, you need to have access to the database server.