Vaadin 13 TextArea Html Styling - textarea

I have two textAreas. For 1st one I want to make labels align row center, for the 2nd column flew-start. I give for every of them own Id and created separate html files for each. But when 1st textarea changes the 2nd one changes like the 1st, I can't give them their own label align.
How can I give for each own label alignment ?

You probably need to use textArea1.addClassName("my-text-area1") and then use something like follows:
<dom-module theme-for="vaadin-text-area" id="style-for-text-area1">
<template>
<style>
:host(.my-text-area1) [part="label"]{
... styles here ...
}
</style>
</template>
</dom-module>
And then do the same for the other text area.

Related

How to use an Angular Material mat-form-field, but with a normal placeholder

Angular Material form fields are potentially very convenient because they add a bunch of classes to the surrounding element depending on whether the field is selected, empty, filled, etc. I want to use these classes to customize the style of the label and other custom elements placed inside the field container (example: making the label change color when the input is focused).
The problem is that Angular Material also adds a bunch of other properties, styles and elements that I don't want to deal with. Even if I add floatLabel="never" and floatPlaceholder="never", the placeholder is still removed from the input and turned into a label, which is positioned relative to the entire container. If I place other elements inside the mat-form-field element (like a regular label), this messes up the positioning of the placeholder-turned-label, causing it to appear outside the input.
Is there any way I can make Angular Material not turn the placeholder into a label, but just leave it as a normal placeholder?
So I wasn't able to actually fix it properly, but I was able to get around the issue by adding styles to undo the style changes that Angular adds.
mat-form-field.mat-form-field-hide-placeholder .mat-input-element::placeholder{
color: #ccc !important;
-webkit-text-fill-color: #ccc !important;
}
mat-form-field.mat-form-field-hide-placeholder .mat-form-field-label-wrapper{
display: none;
}
It would be nicer if there was a way to not have the .mat-form-field-hide-placeholder class added in the first place, but until someone figures this out this will have to do.
Turns out all you need to do is add appearance="none" to the field tag, e.g.:
<mat-form-field appearance="none">
<input matInput [(ngModel)]="email" placeholder="Email">
</mat-form-field>

Set display of section tags to flex or grid

With Reveal.js, I would like to use flexbox and/or grids to layout slides. Unfortunately, it seems Reveal.js always overrides the display property of section tags with block as part of its slide show/hide logic. Viz:
<section class="mylayout">
<div>...</div>
<div>...</div>
</section>
section.mylayout {
display: flex;
}
Has no effect, because Reveal.js adds a style="display: block" attribute to the section tag.
Is there any way around this? It works to put a nested div inside the section and have that be grid/flex, but it just feels clunky and gross to have an extra layer in there that adds no other value than a workaround.
Has anyone else found a different way to address it?
You can set it to use flexbox in the initialization settings now. See this update on the documentation.

How to create an anchor within a div?

I'm looking for a solution that doesn't require JavaScript, jQuery or anything too advanced; mostly HTML/CSS as those are what I am restricted to using.
The idea I have is a layout with two smaller div classes within one div ID. Each box have their own content and are placed side by side. What I'm trying to accomplish is to create an anchor link within one div that changes its content to something else.
e.g. box 1 on default displays "abc" as its content while box 2 displays "def". When you click on an anchor link in box 1, the content would then change to 123-- without affecting what's in box 2 or moving it down with the anchor.
Hopefully that makes sense.
There's no code to edit/work off of so any help would be appreciated.
You can use the :target selector to hide both div, and show element with the ID in the URL hash:
div.MyBox {
display: none;
}
div.MyBox:target {
display: block;
}
Clicking an <a> tag pointing to #someId would then show that element.

What is the use of data-role="fieldcontain"?

I just discovered that text inputs within a div with data-role="fieldcontain" don't expand to the 100%, but if you place a text input outside of a fieldcontain it expands to the fullest. This is a bug that they are fixing, but meanwhile...
So I was wondering what is the use of that data-role="fieldcontain" in the first place? Why to put it? I saw it on the documents and I just put it in my html, but what is the use of putting it?
Thanks!
Looks like it's a Field Container for Grouping and Display
http://jquerymobile.com/demos/1.1.1/docs/api/data-attributes.html
Field container Container with data-role="fieldcontain" wrapped around label/form element pair
Controlgroup DIV or FIELDSET container with data-role="controlgroup". Visually integrate multiple button-styled
inputs of a single type (checkboxes, link-based buttons, radio
buttons, selects) into a group. For grouping form checkboxes and radio
buttons, the fieldset container is recommended inside a div container
with the data-role="fieldcontain", to improve label styling.
data-mini true | false - Compact sized version for all items in the
controlgroupdata-type horizontal | vertical - For horizontal or
vertical item alignment
As of jquerymobile 1.4 data-role="fieldcontain" is deprecated!
use class="ui-field-contain" instead.
see release notes http://jquerymobile.com/changelog/1.4.0/

Setting html controller to right side in firefox extension

I am creating Mozilla extension.
Here I need to set button controller right side in extension.
Here I divide XUL file to div element. I have take a main div element and inside this i have take two more inner div.
Then I have set one inner div style property float:left; and another div style property float:right. But this is not helpful for me.
Here I also set Button CSS style property float:right which is inside the div which have property float:right.
In a XUL window, dialog, page or vbox, elements are displayed from top to bottom, and if you put elements in an <hbox> then those are displayed left to right (except in RTL locales). But sometimes you want a right-aligned object. You then have several options:
The simplest version is <hbox pack="end"><button label="right"/></hbox>
If you also need an element on the left, then you can separate them with a spacer, like this: <hbox><button label="left"/><spacer flex="1"/><button label="right"/></hbox>
Alternatively you can also use <vbox align="end"><button label="right"/></vbox> which works better if you need a radio, checkbox, label or description element to be able to wrap.
Hi Dad you tried to use dir="rtl" this one can be applied to the document or the element ....
You can also specify the language... like it's exist on the HTML Specification...
http://www.w3.org/TR/html401/struct/dirlang.html
For Example
<Q lang="he" dir="rtl">...a Hebrew quotation...</Q>

Resources