If class exist in first parent then apply CSS - class

If class 'hello' visible then apply some css to 'banner2' class. is it possible? Looking for CSS solution not Javascript.
<div id="banner">
<div class="hello"></div>
</div>
<div class="banner2">
</div>

It's not possible to select a div based on visibility in CSS alone. You can easily use jQuery / JS, but since you don't want that I'd suggest trying out some trickery with CSS combinators and the checkbox hack, depending on how you are planning on changing the visibility of "hello".

The option doesn't exist yet in CSS.
When Selectors 4 will be available you could do it this way:
.banner:has(> .hello) + .banner2
But as of this moment, you can only do it with javascript

Related

GWT Widget inheritance and Compositions

In my GWT project, I have a widget "composition(? not 100% sure about the term)", called MenuItem. This has the following structure:
<div class="some invariable class">
<div class="first-child"><!-- something --></div>
<div class="middle-element"><label /></div>
</div>
I want to create widgets, which all have this structure, but in place of <!-- something -->, for instance an IconMenuItem would put a FontAwesome icon, or ImageMenuItem would put a small thumbnail there.
I'm kind of new to GWT and reading the documentation and some topics here at SO, I suspect that MenuItem should extend Composite and *MenuItem should extend this MenuItem.
However, I'm not sure how I would enforce the HTML structure above without duplicating it. I'm also unsure about what the best practice would be to allow different types of elements, like I said about the image and icon example.
What would be the good class structure, which class should inherit/compose which class?

TinyMCE instances in jquery sortable class all MCE Instances

I've encountered a problem when combining JQuery sortable and TinyMCE.
My issue is similar to:
TinyMCE instances in jquery sortable; but I don't know how to "classed all MCE Instances with .tinyMCE", described in the solution.
It would be grateful if anyone can help me out of this.
You need add "tinyMCE" class for all textareas that used tinyMCE.
If you want use solution from example solution you also need to have unique id for each textarea. Like this
<div>
<textarea class="tinyMCE" id="textarea1"></textarea>
</div>
<div>
<textarea class="tinyMCE" id="textarea2"></textarea>
</div>

Different ways to define UI elements in ionic

When using ionic framework for building apps, there are two ways how UI elements can be defined:
using div tags:
<div class="bar bar-header bar-positive">
...
</div>
using directives:
<ion-header-bar class="bar-positive">
...
</ion-header-bar>
In the documentation, the first variant (using div) is used. But in a course I was watching, the second one was used (and it seemed cleaner to me).
What are the differences between the two ways shown above? Is there a preferred or recommended way of defining UI elements?
I recommend you to use Directives instead of Div if you need to access to corresponding APIs. For example for a list : http://ionicframework.com/docs/api/directive/ionList/
Using the directive will allow you to use APIs options.
BUT, if you just want a beautiful UI, and you don't need APIs, you can use div which will render templates fastly.
ion-header-bar tag is just Directive written by ionic with some fantastic attribute which you will not get in div tag
attribute like :
align-title
no-tap-scroll
this both comes with ion-header-bar tag so if you want to perform any action on the view so u can use ion tag or only for view purpose you can use div tag.

How to replace a CSS class by another one when i change the media

I'm new in the usage of CSS, and i'm still in the learning curve
Basically, i want to display a section using the class col-xs-12 when i select the media print instead of a col-xs-9 in all other medias.
Is there an easy way in CSS to do that ?
Using Bootstraps built-in classes you can either use jQuery, plain javascript or #media queries. If you're using Less or something you can use mixins. Since you mentioned you're new to CSS I'm going to assume it's plain old CSS.
You mentioned that you want col-xs-12 and col-xs-9. You can chain sizes together as well. Eg. class="col-xs-12 col-lg-9", etc..
As noted in the .visible-print and .hidden-print classes you can have the following...
<div id="sectionContainer">
<div class="col-xs-12 hidden-print">
<!-- Add the content to see if your viewing on a web page -->
</div>
<div class="col-xs-9 visible-print">
<!-- Content to show in print -->
</div>
</div>
You cannot change classes in CSS -
A viable workaround that does not involve JavaScript would be to make a third class print and copy+paste the css rules from col-xs-12 to it --
Add this new class to everything that is col-xs-9 which you want to be displayed as col-xs-12 on media print,
and finally, to keep things smooth, put whatever styles you need and your new .print styles into a separate .css file and link it in the head:
<link rel="stylesheet" type="text/css" href="print.css" media="print">
(or, if it isn't a gigantic file at that point, #media only print{} is acceptable )
Alternatively, if you won't be using the col-9 class, you can just swap their classnames in your #media section.
Or, if you're comfortable with a javascript solution, you could add a "Print" button to your page that would do something like
$("#printButton").click(function(){
$(".col-xs-9").addClass("col-xs-12").removeClass("col-xs-9");
});
A media query can only change what the selectors' rules are from size to size, it can't change the selectors you've put into the markup. To change the class in the markup would require the use of Javascript.
YOu oould restyle you col-xs-12 specifically for print to match that of col-xs-12 , or similarly, add a new class, col-xs-12-print and style it to match col-xs-9
when using twitter bootstrap they have classes to hide and show certain elements for print
.visible-print and .hidden-print
http://getbootstrap.com/css/#responsive-utilities-print

Creating Custom Content Element in TYPO3

Cany anybody tell me how to render the following structure in
typo3 without developing a new extension.
<div class="sidebar-details">
<div class="sidebar-details-title">
<h4><span>MY TITLE</span></h4>
</div>
<div class="sidebar-details-body">
<p>
TEXT
</p>
</div>
</div>
What would be the best/recommended way to achieve this ?
Start using gridelements.
Gives you exactly what you want.
http://typo3.org/extensions/repository/view/gridelements
You can activate the RTE html mode and put it in its source or make use of HTML element, but that's depending on your needs.
If you want to keep RTE functions for editing the text what I mentioned first is the recommended way. Have done it several times myself.
If you are using Template mapping using Templavoila so, you can create FCE(Flexible content element) for it and you can map this part.
If you are using fluid template mapping so, you can create gridelement for it. and map all part.