...wrap at a soft hyphen, it is turned into a regular hyphen character (‐). The HTML entity for a soft hyphen is ­. Use it to mark division opportunities in a...

...hyphenized. E.g. brand names like makandra should not be hyphenated. Option 3: wbr-tags HTML has a tag you can use to mark word wrap opportunities: Do nau dampf schiff...

...below is validated for the current list of browsers we support. By default your html and body elements are only as high as the actual page content inside their container...

...If you only have two lines of text in your page, your html and body elements will only be around 40 pixels high, regardless of the size of your browser...

However, your application must do one thing by itself: When sending HTML e-mails, you should include a plain-text body or tools like SpamAssassin will apply...

Actually, you may want to configure premailer-rails, and maybe tweak your HTML e-mail views a bit. Here are some suggestions. Open Rails' ActionMailer Previews and you...

This card describes different flavors for concatting HTML safe strings in a helper method in Rails. You might want to use the tag helper instead of the content_tag helper...

...the tag helper knows all self closing tags). Example We want to generate HTML like this: Navigation Left Right Below you can find multiple helper variants that generate this markup...

guides.rubyonrails.org

Append your locale keys with _html to have them marked as html_safe and translate them with = t('.text_html'). When you're localizing a Rails application, sometimes...

...there is this urge to include a little HTML. Be it some localized link, or a set of tags, you'd like to have it included in the locale file...

...button to render somewhere else, it should still be the first button in the HTML source. You can use CSS (e.g. flex-direction) to change the visual order without changing...

...the order in the HTML markup...

simple_format ignores Rails' XSS protection. Even when called with an unsafe string, HTML characters will not be escaped or stripped! Instead simple_format calls sanitize on each of the...

...big", "cite"}> If you don't want user input with markup to appear as HTML, you need to escape yourself: simple_format(h(user_input)) If you're using Rails...

...element as the main document viewport. In CSS, prefer to set overflow properties to html (or :root). Scrolling the main viewport with JavaScript The browser's main document viewport is...

...whatever scrolling element their implementation uses. I recommend to set any overflow property to html (or :root). Don't set overflow-y for both and or funny things will happen...

...visual rendering of your page will not be affected. If you care about their HTML being valid, your new element should contain a dash character (-) to mark it as a...

...custom element. Custom elements will be ignored for the purposes HTML validation, but their children will still be validated. Styling new elements Browsers will give unknown elements a default style...

The attached compiler() function below applies JavaScript behavior to matching HTML elements as they enter the DOM. This works like an Unpoly compiler for apps that don't use Unpoly...

...Custom Elements or any other mechanism that pairs JavaScript with HTML elements. The compiler() function is also a lightweight replacement for our legacy $.unobtrusive() helper (no jQuery required).

The RSpec matcher tests if two HTML fragments are equivalent. Equivalency means: Whitespace is ignored Types of attribute quotes are irrelevant Attribute order is irrelevant Comments are ignored

html = ... expect(html).to match_html(<<~HTML) Expected content HTML You may override options from CompareXML by passing keyword arguments after the HTML string: html = ...

github.com

...class GroupsController < ApplicationController def members group_ids = params[:group_ids].split(',') group_ids_and_html = {} group_ids.each do |group_id| group = load_group(group_id) group_ids_and_html[group_id...

...render_group_html(group) end render json: group_ids_and_html end private def load_group(group_id) Group.find(group_id) end def render_group_html(user_group)

...chapters explain different approaches in Rails, how you can assign such an association via HTML forms. In most cases you want to use Option 4 with assignable values.

...chapters explain different approaches in Rails, how you can assign such an association via HTML forms. Option 1: Array column One way to solve the problem is using a database...

To bind an HTML value to ng-bind-html, you need to mark it as "trusted" first. Among other ways, you can do so with a custom filter.

...Coffeescript...: @app.filter 'htmlSafe', ['$sce', ($sce) -> $sce.trustAsHtml ] # ...or JS: app.filter('htmlSafe', [ '$sce', function($sce) { return $sce.trustAsHtml; } ]); # Usage: This is a replacement for the ng-bind-html-unsafe directive which has been...

...HTML elements can automatically start playing when the autoplay attribute is set on them. Except for when they can not, e.g. on pageload, or when the element enters the DOM...

Code snippet tested with Rails 2.3 def index # ... if request.xhr? html = render_to_string(:partial => "list", :layout => false) respond_to do |format| format.html { render :text => html } format.json { render :json => {:html...

...html,...

end end end Note: Perhaps you ran into ActionView::MissingTemplate error and this card might help. If you call render_to_string within the format.json block, Rails will only...

thoughtbot.com

While both the alt attribute and the figcaption element provide a way to describe images, the way we write for...

Nokogiri is great. It will even fix invalid HTML for you, like a browser would (e.g. move block elements out of parents which are specified to not allow them).

...HTML.fragment(" foo bar ").to_s => " foo bar " While this is mostly useful, browsers are actually fine with a bit of badly formatted HTML. And you don't want to be...

adactio.com

Web forms can be made much more usable with a few HTML attributes. Short summary: type: Tells browsers about the input data type. Mobile browsers will select a virtual keyboard...

makandra dev

Besides their default styling properties, HTML elements have a semantic meaning. For example, an h1 tag is usually styled with a larger font and bold, while it denotes "the single...

...most important headline in its context". While CSS enables us to style almost any HTML element like anything that is needed, choosing HTML elements corresponding to the meaning of their...

developer.mozilla.org

...HTML's accepts a single file. You can allow multiple files via . But sometimes, selecting multiple files is not enough and can be cumbersome for the user. Enter webkitdirectory:

...feel future-proof. On JavaScript file objects, webkitRelativePath is supported similarly to webkitdirectory in HTML. As a fallback for older browsers you can use name (which won't include any...

Browsers can auto fill-in one time codes if advised. Use it like this: Demo: https://twitter.com/sulco/status/1320700982943223808 Browser support...

tl;dr In Chrome DevTools in the Elements tab or in Firefox in the Inspector tab you can right click...

Use the htmlentities gem. Encoding works like this: require 'htmlentities' coder = HTMLEntities.new string = "<élan>" coder.encode(string) # => "&lt;élan&gt;" coder.encode(string, :named) # => "&lt;&eacute;lan&gt;" coder.encode(string, :decimal...

coder.encode(string, :hexadecimal) # => "&#x3c;&#xe9;lan&#x3e;" Decoding works like this: require 'htmlentities' coder = HTMLEntities.new string = "&eacute;lan" coder.decode(string) # => "élan...