Instead of specifying CSS styles with highchart options such as (fontWeight, fontColor, etc), is it possible to use CSS classes for styling the different elements of a chart?
In many cases (tooltip,labels) you can set useHTML as true, and then use CSS styles without !important or use formatter to define your own elements with CSS styles.
Example http://api.highcharts.com/highcharts#tooltip.useHTML
Yes, you have to use !Important because it's the only way to override inline style.
Your chart is render on some content which you have to pass it's id on chart.rendertTooption.
So you can match the elements by your chart container, like.
#container text {
font-size: 14px !Important;
}
Demo
Your highcharts chart is an SVG in your html.
You need to inspect the SVG source code to know the names of the classes and then you can use them in your CSS.
You need to add !important because some default styles already exist in the SVG.
For example
You can use
text {
fill:red !important;
font-family: "Arial" !important;
font-size : 12px !important;
}
To define default font color, family and style
or
.highcharts-yaxis-labels text
{
(some css )
}
to define the y-axis labels style
You can use css class name in highcharts 'chart' option but these changes will not reflect on exported chart. For example:
chart{
type: 'line',
className: 'someCss'
}
css:
.someCss{
border-top-left-radius: 25px;
font-weight: bold;
font-style: italic;
}
Related
I am trying to overwrite mat-form-field styles using ::ng-deep .mat-form-field**. But I read that it would be deprecated soon.
I overrode some styles using ::ng-deep and it partially solves my need. But I also want to use default mat-form-field in some cases.
In my case I decreased height and removed extra padding at bottom for hint as I need to use dense fields in form and having hint padding adds scroll bars.
But I have some dialogs where I can use default mat-form-field and use mat-hint like normal.
I have the below styling in a scss file and I import this file into my component scss using #import
::ng-deep .mat-form-field-flex > .mat-form-field-infix { padding: 0.4em 0px !important;}
::ng-deep .mat-form-field-label-wrapper { top: -1.5em;}
::ng-deep .mat-form-field-appearance-outline.mat-form-field-can-float.mat-form-field-should-float .mat-form-field-label {
transform: translateY(-1.1em) scale(.75);
}
::ng-deep .mat-form-field-wrapper{
padding-bottom: 0;
}
Can someone suggest a way to be able to use both styles, like extending mat-form-field and customizing it in applying for my dense form and using mat-form-field normally at other places?
I saw that the Material Team uses attributes like dense for the mat-lists. So, you can have a global customization in your styles.scss like:
.mat-form-field[dense] {
.mat-form-field-flex > .mat-form-field-infix {
padding: 0.4em 0px !important;
}
.mat-form-field-label-wrapper {
top: -1.5em;
}
&.mat-form-field-appearance-outline.mat-form-field-can-float.mat-form-field-should-float .mat-form-field-label {
transform: translateY(-1.1em) scale(.75);
}
.mat-form-field-wrapper{
padding-bottom: 0;
}
}
and just add the attribute to your fields:
<mat-form-field dense ...
This kind of atttibutes can be considered as "component variants", and some CSS methodologies suggest to define a class for it like .mat-form-field-dense but I like the attributes approach better :)
Edit: If you want to include this kind of deep customization in your component, you need to disable the encapsulation including:
#Component({
...
encapsulation: ViewEncapsulation.None
})
that will tell Angular to not mark your Component Styles with an attribute that encapsulates your styles to work only with your component elements, and not interfer with another components sub-elements. Please refer to the Angular Styles official documentation if you want to know how it works ;)
I want the color of the underline to be different from the color of the text.
I already tried with
text-decoration: underline;
text-decoration-color: red;
but the underline takes the color of the text.
Thanks.
Axis labels are SVGs by default. SVG can be styled via CSS but only a subset of CSS options is supported. For more advanced styling set xAxis.labels.useHTML to true and use this code:
.highcharts-xaxis-labels span {
text-decoration: underline;
text-decoration-color: red;
}
Live demo: http://jsfiddle.net/kkulig/ambL84be/
API reference: https://api.highcharts.com/highcharts/xAxis.labels.useHTML
On iOS (Safari 5) I have to following for input element (top inner shadow):
I want to remove top shadow, bug -webkit-appearance doesn't save.
Current style is:
input {
border-radius: 15px;
border: 1px dashed #BBB;
padding: 10px;
line-height: 20px;
text-align: center;
background: transparent;
outline: none;
-webkit-appearance: none;
-moz-appearance: none;
}
You'll need to use -webkit-appearance: none; to override the default IOS styles. However, selecting just the input tag in CSS will not override the default IOS styles, because IOS adds it's styles by using an attribute selector input[type=text]. Therefore your CSS will need to use an attribute selector to override the default IOS CSS styles that have been pre-set.
Try this:
input[type=text] {
/* Remove First */
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
/* Then Style */
border-radius: 15px;
border: 1px dashed #BBB;
padding: 10px;
line-height: 20px;
text-align: center;
background: transparent;
outline: none;
}
Helpful Links:
You can learn more about appearance here:
http://css-tricks.com/almanac/properties/a/appearance/
If you'd like to learn more about CSS attribute selectors, you can find a very informative article here:
http://css-tricks.com/attribute-selectors/
background-clip: padding-box;
Seems to remove the shadows as well.
As #davidpauljunior mentioned; be careful setting -webkit-appearance on a general input selector.
webkit will remove all properties
-webkit-appearance: none;
Try using the property box-shadow to remove the shadow on your input element
box-shadow: none !important;
Whilst the accepted answer is a good start, as others have pointed out, it only works for inputs whose type is "text". There are a myriad of other input types which also render as text boxes on iOS, and so we need to expand this rule to take into account these other types.
Here's the CSS I'm using to rid input text fields and textareas of the inner shadow, whilst preserving the default styling for buttons, checkboxes, range sliders, date/time dropdowns and radio buttons, all of which are authored using the humble <input> tag too.
textarea,
input:matches(
[type="email"],
[type="number"],
[type="password"],
[type="search"],
[type="tel"],
[type="text"],
[type="url"]
) {
-webkit-appearance: none;
}
I tried to come up with a solution that a.) works and b.) I am able to understand why it works.
I do know that the shadow for inputs (and the rounded border for input[type="search"]) comes from a background-image.
So obviously setting background-image: none was my first attempt, but this does not seem work.
Setting background-image: url() works, but i am still concerned about having a empty url(). Altough it currently is just a bad feeling.
background-clip: padding-box; seems to do the job as well, but even after reading the "background-clip" docs I don't get why this completly removes the background.
My favorite solution:
background-image: linear-gradient(transparent, transparent);
This is valid css and I do understand how it works.
This works better for me. Plus it means I don't have to apply it to every different type of input (i.e. text, tel, email, etc).
* {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
I am new to using syntaxhighlighter. I am using there latest version 3.0.83. Can some one help how to customize the color of comments, header, etc ?
I am using < pre class="brush: c"> for coding style.
The easiest solution would be to override the CSS rules for comments, but they're marked as !important so you have to do a little extra work.
Open your shBrushCpp.js file. Down towards the bottom there's a set of regular expression rules paired with a css property. Those values correspond to class names in shThemeDefault.css (or whatever theme you're using).
Copy your theme file to something like shThemeCustom.css or whatever you want. Include this file on your page instead of the original theme. From here, you can change whatever you want. Just reference the CSS rules from the brush file against your custom theme to know what needs to be changed.
In case you don't have full control over the .css or .js files, as is my case (since I followed these instructions here and am using Alex Gorbatchev's hosted files instead), there is still a way to override the !important parameter.
You can customize any of the settings shown here (http://agorbatchev.typepad.com/pub/sh/3_0_83/styles/shThemeDefault.css), for example, as follows:
With the default theme, this HTML...
<pre class="brush:cpp" title="test code">
int myFunc()
{
//do something
return 1;
}
</pre>
...yields this result:
Looking here (http://agorbatchev.typepad.com/pub/sh/3_0_83/styles/shThemeDefault.css), I can see the parameters I am currently using. For example, it contains:
.syntaxhighlighter {
background-color: white !important;
}
.syntaxhighlighter .line.alt1 {
background-color: white !important;
}
.syntaxhighlighter .line.alt2 {
background-color: white !important;
}
...
.syntaxhighlighter .comments, .syntaxhighlighter .comments a {
color: #008200 !important;
}
In order from top to bottom, as shown just above, my header background color is white and my alternating code lines 1 and 2 are both white. Comments are green (#008200). Let's change all of that. Add the following code to your blogger template, at the very end of your header, just above </head>:
<style type='text/css'>
.syntaxhighlighter {
max-height: 550px;
background-color: #ff0000 !important;
overflow-y: auto !important;
overflow-x: auto !important;
}
.syntaxhighlighter .line.alt1 {
background-color: #99ff99 !important;
}
.syntaxhighlighter .line.alt2 {
background-color: #99ff99 !important;
}
.syntaxhighlighter .comments, .syntaxhighlighter .comments a {
color: #000082 !important;
font-weight: bold !important;
}
</style>
Now, I have set my max-heightto 550 pixels (make a really long code block and you'll see it constrained to this height now, with a vertical slider to see it all), my header background color is red (#ff0000), my code background color (both alternating lines) is light green (#99ff99), and my comments are blue (#000082) and bold. Follow this format to customize anything you see in your .css theme file--example, for me, here: http://agorbatchev.typepad.com/pub/sh/3_0_83/styles/shThemeDefault.css.
Here is my final result--very different from the default look above:
Note that the font-weight parameter I set is simply a CSS styling you can apply. Many other options exist. See here: http://www.w3schools.com/cssref/pr_font_weight.asp.
I have not had any luck changing the line height for sIFR. I have tried changing the sIFR css and config file as well as my general style sheet. Is there a special trick?
GENERAL CSS
h1 {
font-family: Georgia, Times, serif;
font-size: 24px;
font-style: normal;
line-height: 16px; (has had zero impact, even when I go negative)
color: #000000;
text-transform: uppercase;
margin: 0;
padding: 0;
outline: none;
}
CONFIG FILE
sIFR.replace(minionpro, {
selector: 'h1', wmode: 'transparent',
css: '.sIFR-root { color:#000000; text-transform: uppercase; }'
});
Flash uses leading instead of line-height, so simply just use:
sIFR.replace(minionpro, {
selector: 'h1', wmode: 'transparent',
css: '.sIFR-root { color:#000000; text-transform: uppercase; leading: 1.5; }'
});
The leading value must just be a number on its own with no measurement value such as px, em, %, etc.
At first I thought it wasn't working, but I realized that the units for leading are totally different from em. I tried a larger value "leading: -10;" and it worked fine. I'm using sIFR 3 r436.
I'm going to take a wild guess and say that because your font-size > line-height (24px > 16px) sIFR is going to ignore the line-height property and use the font-size to create your flash.
If you're trying to get two lines of overlapping text (24px text on a 16px line will result in 8px of overlap), you're probably stretching the capabilities of sIFR.
EDIT
It looks like sIFR has some strange methods for calculating font size based on different factors...check out the link for the details (without knowing your version of sIFR, I can't comment on your situation).
Novemberborn: Font Sizing with sIFR
Line height inside the Flash movie is controlled using the (custom) leading CSS property for the .sIFR-root class. Flash doesn't have the concept of line-height as you might be familiar with from CSS.