How to style a unique checkbox to look like Expand/Collapse (Pega 8.6) - css

we're trying to create a checkbox to look like the expand/collapse button and have a section appear/hide based on the checkbox state....so we made a special format for checkboxes called 'Expand Collapse' and placed it in the Skin in order to apply more styling on it via CSS.
We already have a special customization in place for all checkboxes in the application (code below)... we want to create a similar customization but with different backgrounds for the 'expand_collapse" class... (screenshot below)
would appreciate some help writting that in css (any code I write keeps applying to all checkboxes and not one in specific...)
Update Solution [6/17]:
thanks to the reply on here I was able to create the following helper class (checkbox-expand) and apply it in the Advanced Presentation Options for the checkbox
/****************************************
Type: helper-class
Name: checkbox-expand
Category: cell
Description: Applies styles to the checkbox control to display it as a expand
*********************************************************/
.checkbox-expand,
.checkbox-expand > .checkbox {
position: relative;
}
.checkbox-expand input.checkbox[type="checkbox"],
.flex.content > .flex.content-item .checkbox-expand input.checkbox[type="checkbox"] {
min-width: 0!important;
margin: 0!important;
font-size: 0;
width: 0!important;
height: 0!important;
border: 0!important;
}
.checkbox-expand input.checkbox[type="checkbox"],
.checkbox-expand input.checkbox[type="checkbox"]::before,
.checkbox-expand input.checkbox[type="checkbox"]::after {
margin: 0;
cursor: pointer;
vertical-align: middle;
line-height: 30px;
}
.checkbox-expand .checkbox[disabled],
.checkbox-expand .checkbox[disabled]::before,
.checkbox-expand .checkbox[disabled]::after {
pointer-events: none;
}
.checkbox-expand input.checkbox[type="checkbox"] {
position: relative;
padding-left: 54px;
display: inline-block;
z-index: 2;
-webkit-tap-highlight-color: transparent;
min-height: 42px;
font-size: 18px/* adjust as preferred - is not inherited */
}
.checkbox-expand input.checkbox[type="checkbox"]::before,
.checkbox-expand input.checkbox[type="checkbox"]::after {
content: "";
display: block;
position: absolute;
top: 0;
left: 0;
transition: all .15s;
}
.checkbox-expand input.checkbox[type="checkbox"]::after {
border-radius: 15px;
width: 24px;
height: 24px;
margin: 2.5px;
background: url('webwb/ArrowDown.svg') no-repeat 50% 50% !important;
}
.checkbox-expand input.checkbox[type="checkbox"]:checked::before {
background-color:transparent;
background-image: none;
border-color: transparent;
color: transparent;
height: 30px;
width: 50px;
margin: 0;
}
.checkbox-expand input.checkbox[type="checkbox"]:checked::after {
-moz-transform:scaleX(-1) scaleY(-1);
-o-transform:scaleX(-1) scaleY(-1);
-webkit-transform:scaleX(-1) scaleY(-1);
transform:scaleX(-1) scaleY(-1);
}

Go to Presentation tab of Checkbox Control.
Go to the Advanced Presentation Option
In the Cell read-write classes and Cell read-only classes give a css class name. For example regular-checkbox.
Now go to CSS file where you have customized the Checkboxes.
Replace input[type="checkbox"] with .regular-checkbox input[type="checkbox"] and refresh the browser screen on which that check box is present to see the results.
Now you can use this CSS class in specific checkboxes.

Related

Add arrows to dropdown menu CF7

I'm using Contact Form 7 on a website of a client, and I styled the dropdown menu to this:
.wpcf7-form select {
-webkit-appearance: textfield;
color: #72858a;
font-size: 0.7777777778rem;
background-color: #e9edf0;
border-color: #e9edf0;
padding-top: 5px;
padding-bottom: 5px;
}
Unfortunately the arrows are missing now. Is there anyway to add an down arrow at the right side of the dropdown menu in the same color as the text? I tried different css classes found on this website, but nothing seems to work.
Image of how it displays now:
And how it should be:
The arrow could also be another arrow.
Any help would be appreciated much!
Regards,
Vasco
Here's an option for you... now... I used the span.wpcf7-form-control-wrap that was specifically around the select I was styling. You could also (instead) wrap the selects in a custom div.
This produced this result for me
I also made the triangle using clip-path, so you can change the colors or anything else.
/* Using the menu-813 which for me was the span around the select.*/
span.wpcf7-form-control-wrap.menu-813 {
position: relative;
height: 60px;
background: #e9edf0;
display: inline-block;
}
span.wpcf7-form-control-wrap.menu-813:after {
content: '';
position:absolute;
width: 15px;
height: 15px;
background: #000;
right:8px;
top: 20px;
z-index: 0;
clip-path: polygon(100% 0, 0 0, 50% 100%);
}
.wpcf7-form select {
-webkit-appearance: none;
appearance: none;
color: #72858a;
font-size: 0.7777777778rem;
background-color: transparent;
border-color: #e9edf0;
padding-top: 5px;
padding-bottom: 5px;
width: 300px;
z-index: 1;
position: relative;
padding-left: 2ch;
}

Override bootstrap css only in one react component

so I'm using a gorgeous search bar component that I found on codepen in my react (CRA) project.
I have imported css in the default src/index.js
Then I have my search component which is composed of Search.js and Search.module.css.
Clearly Bootstrap styling and the Search component styling doesn't work together, when I comment the bootstrap file import in src/index.js, the Search component will be working fine.
So how can I override bootstrap only on my Search Component?
Here is the css of the Search.module.css
#import url("https://fonts.googleapis.com/css?family=Roboto:400,400i,700");
* {
font-family: Roboto, sans-serif;
padding: 0;
margin: 0;
}
.flexbox {
background: linear-gradient(155deg, #cccccc, #e8ecee, #d4d4d4);
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.search {
margin: 20px;
}
.search>h3 {
font-weight: normal;
}
.search>h1,
.search>h3 {
color: white;
margin-bottom: 15px;
text-shadow: 0 1px #eaeff1;
}
.search>div {
display: inline-block;
position: relative;
}
.search>div:after {
content: "";
background: white;
width: 4px;
height: 20px;
position: absolute;
top: 40px;
right: 2px;
transform: rotate(135deg);
box-shadow: 1px 0 #eaeff1;
}
.search>div>input {
color: white;
font-size: 16px;
background: transparent;
width: 25px;
height: 25px;
padding: 10px;
border: solid 3px white;
outline: none;
border-radius: 35px;
box-shadow: 0 1px #eaeff1;
transition: width 0.5s;
}
.search>div>input::placeholder {
color: #5a5a5a;
opacity: 1;
}
.search>div>input::-ms-placeholder {
color: #efefef;
}
.search>div>input::-ms-input-placeholder {
color: #5a5a5a;
}
.search>div>input:focus,
.search>div>input:valid {
width: 250px;
}
As you haven't shared the code snippets. I am assuming the bootstrap search will be using: text and button tag. Now, the CSS of this would be coming from bootstrap.
You can do the following:
1) Make a search component level class eg "search-module"
2) Now, create css or scss file import in the search component and within that css
override the bootstrap css by :
.search-module input[type=search] {...}
OR
3) you can do this overriding on your main style.css file too.
You need do to step 2 for all the other conflicting classes, tags, and IDs in the bootstrap with the search component.
PS: This will bloat your CSS. Best would be if you can just pick that part of Bootstrap which is required and rest you write your own style.
Thank you.

IE 7/8 rendering issue?

Within ie8, the document is rendered as intended.
Within ie7, the document is not
(built on top of bootstrap with additional css)
markup:
.modal.fade.in#unsupported-browser-modal
.modal-dialog
.modal-content
.modal-text
.modal-header
%h3.modal-title YOUR BROWSER IS OUT OF DATE
.modal-body
This website requires a minimum of Internet Explorer version 9 or the latest version of other popular web browsers.
additional css:
#unsupported-browser-modal {
.modal-dialog, .modal-content {
height: 100%;
}
.modal-dialog {
width: 100%;
margin: 0;
max-width: none;
min-width: none;
}
.modal-content {
border-bottom: 0;
}
.modal-header {
border-bottom: 0;
padding: 15px;
min-height: 16.42857143px;
}
.modal-title {
font-family : $var;
text-align : center;
font-weight : bold;
letter-spacing : 2px;
margin-top: 50px;
}
.modal-body {
font-family: $var1;
font-size: 14px;
text-align: center;
padding: 2px 35px 80px;
color: #646464;
line-height: 20px;
}
}
#unsupported-browser-modal.modal {
display: block;
}
.modal-text {
top: 37%;
position: relative;
}
Also, document.compatMode seems to be set to the same value in both ie7 as well as i8, in case that may be of interest.
Thoughts as to what I may not be accounting for?
Not sure if it's what your looking for. It's also, a bit of an hack so I wouldn't suggest it unless no one suggests a solution/you don't find one. But try:
_margin-top: 100px; /* ie7 only */
Can read more about safe CSS hacks if your interested here:https://mathiasbynens.be/notes/safe-css-hacks#css-hacks

Inherit CSS class from separate file?

I have a class for a button:
.client-header button {
/*Properties*/
}
and a class to detect when the menu is open:
.client-menu-open {
/*Properties*/
}
I would like to change the button background based on whether or not the menu is open. I want something like this:
.client-header button .client-menu-open {
/*Properties*/
}
But the classes are in two different files, so it doesn't work. Is there any way to do this across different files?
Here is the code for the header index.css:
#import url('../menu/index.css');
.client-header {
position: absolute;
top: 0;
left: 0;
right: 0;
height: var(--header-height);
overflow: hidden;
border-bottom: 1px solid #7E7E7E;
background: #cccccc;
}
.client-header button {
float: left;
height: 100%;
border: none;
border-right: 1px solid var(--border-color);
border-radius: 0;
box-shadow: none;
line-height: 39px;
background-color: #444444;
color: #FFF;
}
.client-header button:hover {
background-color: #555555;
}
.client-header button:active {
background-color: #4E4E4E;
}
.client-header-caption {
float: left;
}
.client-header-title,
.client-header-subtitle {
margin-left: 10px;
}
.client-header-title {
line-height: 25px;
}
.client-header-subtitle {
font-size: 0.5rem;
line-height: 15px;
}
#media (min-width: 640px) {
.client-header-title,
.client-header-subtitle {
display: inline-block;
line-height: var(--header-height);
}
.client-header-title {
font-size: 1.5rem;
}
.client-header-subtitle {
font-size: 1rem;
}
}
.client-header .client-menu-open button {
background: #CCCCCC;
}
And here is the code for the menu index.css:
.client-menu {
position: absolute;
top: var(--header-height);
bottom: 0;
left: -var(--menu-width);
width: var(--menu-width);
border-right: 1px solid var(--border-color);
padding-bottom: var(--menu-footer-height);
overflow: hidden;
transition: left 0.2s;
}
.client-menu-open {
left: 0;
box-shadow: 0 0 30px var(--shadow-color);
background: #444444;
}
.client-menu-pinned {
box-shadow: none;
}
.client-menu-header {
height: var(--menu-header-height);
text-align: right;
background-color: #444444;
}
.client-menu-footer {
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: var(--menu-footer-height);
text-align: right;
}
And the HTML structure is:
<header class="client-header">
<button class="client-header-menu-toggle"/>
</header>
<div class="client-menu"/>
You can use #import like so (in your primary CSS stylesheet):
#import url('external.css');
/* external.css above will be loaded */
Refer to this documentation: http://www.cssnewbie.com/css-import-rule/
Link to the other file and style .client-menu-open
if this is your html
<div class="client-menu-open"> <!-- this class is here only if the menu gets opened, else, this div has no class -->
stuff
stuff
<div class="client-header-button">
<button></button>
</div>
</div>
the correct syntax is the following
button {
background:red;
}
.client-menu-open button {
background:blue
}
The #import rule allows you to include external style sheets in your document. It is a way of creating a style sheet within your document, and then importing additional rules into the document.
To use the #import rule, type:
<style type="text/css">
#import url("import1.css");
#import url "import2.css";
</style>
For more info refer here https://developer.mozilla.org/en-US/docs/Web/CSS/#import
your CSS selector is incorrect, that's why it doesn't work. It has nothing to do with where CSS styles are defined.
.client-header button .client-menu-open will only select the following elements:
elements with class="client-menu-open"
which are children of button elements
which themselves are children of elements with class="client-header"
.
what you want, I think, is
button elements
which are children of elements having "class=client-header" AND "class=client-menu-open".
the proper selector for those elements would be .client-header.client-menu-open button.

CSS - difficulty with custom check boxes between IE and Firefox

I have written some code to help "skin" checkboxes and radio buttons using only CSS. It works very, very well ...
.... in Chrome.
However in FireFox and IE, it just ...fails outright. And I have absolutely no earthly idea why. The basic gist of it is that it loads a block using :before before the content and then places it over the default element. Of course it will be replaced with a sprite, but I have to get the outlaying behavior to function first. The code works like this; The way it is laid out in HTML is because I am using Bootstrap, and I am just adhering to the way it lays form fields out. I also have a Fiddle to demonstrate the problem.
Samples
jsBin
Includes the original LESS content.
jsFiddle
Only compiled CSS
HTML
<div class="checkbox">
<label>
<input type="checkbox" value="">
<span style="font-size: 24px;">Option</span>
</label>
</div>
LESS/CSS
.checkbox, .radio {
position: relative;
& + .checkbox {
margin-top: 10px;
&.pull-left {
left: 6px;
}
}
& + .radio {
margin-top: 10px;
left: 20px;
}
input[type="checkbox"] {
&:active, &:hover, &:focus {
&:before,
&::before {
background: yellow;
}
}
&:checked,
&:active:checked,
&:hover:checked,
&:focus:checked {
&:before, &::before {
background: green;
}
}
}
input[type="radio"] {
&:active:before,
&:hover:before,
&:focus:before {
background: yellow;
}
&:checked:before,
&:active:checked:before,
&:hover:checked:before,
&:focus:checked:before {
background: green;
}
}
input[type="radio"] {
&:before, &::before {
opacity: 1;
position: absolute;
content: "";
display: block;
background: black;
height: 24px;
width: 24px;
top: 2px;
}
}
input[type="checkbox"] {
&:before, &::before {
opacity: 1;
position: absolute;
content: "";
display: block;
background: black;
height: 24px;
width: 24px;
top: 2px;
}
}
label {
line-height: 24px;
padding-left: 10px;
}
}
Old browsers unfortunately aren't able to style radio buttons. What you should do is to use a plugin like http://fronteed.com/iCheck/ which automatically creates div based checkboxes that you can style on your own and clicking on those sync with the actual checkboxes.

Resources