How would I add a small triangle image located locally on my machine at that location to the beginning of the table line?
Heres my CSS
stock:nth-child(1){
display:table-row;
content: url('..\stock\down.gif');
color:red;
}
And the corresponding XML
<stock class="down">
<symbol>AAPL</symbol>
<company>Apple Computer, Inc.</company>
<lastSale>$15.26</lastSale>
<netChange>-0.17</netChange>
<pChange>-1.10%</pChange>
<volume>5.548</volume>
</stock>
Here is a much much better way to write the css
stock[class~=down]{
border-bottom: 2px solid black;
display:block;
background: url("down.gif") no-repeat;
color:red;
}
It's a lot easier to do this with XSLT, where you can run a foreach across each of the children in your file and apply styles from a spreadsheet, but you can do this with XML and CSS. You'll need to set the headers in your xml file, and then call the stylesheet, like so:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="stylesheet.css"?>
<stock class="down">
<symbol>AAPL</symbol>
<company>Apple Computer, Inc.</company>
<lastSale>$15.26</lastSale>
<netChange>-0.17</netChange>
<pChange>-1.10%</pChange>
<volume>5.548</volume>
</stock>
Then you just need to modify your CSS file to make whatever changes you like.
For instance:
(Edit for image):
stock {
display:block;
margin-left:20px;
}
symbol {
display: list-item;
list-style: url("..\stock\down.gif");
}
company {
display: list-item;
list-style: url("..\stock\down.gif");
}
You can then change this how you like, in the same way you'd style for HTML
Related
My web2py project has an html file that contains only these two lines of code
{{extend 'layout.html'}}
{{=form}}
I want to write some inline css that should override the css that will be loaded from layout.html. I want to know if this is possible and if so, then how?
Here's the style that I want to add
.error {
margin-top: 0px
}
Here's how you can add inline CSS:
{{extend 'layout.html'}}
{{=form}}
<style>
.error {
margin-top: 0px;
}
</style>
I have just started to explore GWT, and i'm bit confused with different ways of applying styles to GWT widgets.In gwt docs, there are 4 ways by which you can override default style of a widget,
1) Using a tag in the host HTML page.(Deprecated)
2) Using the element in the module XML file.(Deprecated)
3) Using a CssResource contained within a ClientBundle.
4) Using an inline element in a UiBinder template.
Suppose i have a CSS file in some package say, com.abc.xyz.styles.css .And the file has the following contents,
/**the panel itself**/
.gwt-TabLayoutPanel {
border: none;
margin: 0px;
padding: 0px;
}
/**the tab bar element**/
.gwt-TabLayoutPanel .gwt-TabLayoutPanelTabs {
background-color: #F4F4F4 !important;
}
/**an individual tab**/
.gwt-TabLayoutPanel .gwt-TabLayoutPanelTab {
background-color: #6F6F6E !important;
}
.gwt-TabLayoutPanel .gwt-TabLayoutPanelTab-selected {
background-color: white !important;
}
/**an element nested in each tab (useful for styling)**/
.gwt-TabLayoutPanel .gwt-TabLayoutPanelTabInner {
font-family: Arial !important;
}
/**applied to all child content widgets**/
.gwt-TabLayoutPanel .gwt-TabLayoutPanelContent {
border: none;
margin: 0px;
overflow: hidden;
padding: 15px;
}
How will i inject this css file ? How can this be done using the 3rd and 4th option of styling mentioned above?.
You can simply add your CSS file to the host page. Then you can use the full power of CSS selectors. This is my preferred method of using CSS in GWT:
What the best strategy to structure CSS in GWT?
I am in the process of creating a module for a WordPress theme which allows users to change the primary colour. Rather than doing an overkill and implementing a LESS compiler, I will do it this way:
Here's the original stylesheet:
.header a:hover
{
color: #fff;
width: 123px;
height: 456px;
}
.header
{
background-color: #000;
width: 100%;
height: 200px;
}
Now, I need a way to parse a stylesheet like the above and extract all styles that contain a certain colour. Maybe a tool where I can enter the colors "#fff" and "#000" which then extracts the following:
.header a:hover
{
color: #fff; // matched (removed the rest)
}
.header
{
background-color: #000; // matched (removed the rest)
}
This way, I could simply include the above in a PHP file and render the respective primary colours dynamically to override the default stylesheet.
Does anybody know if there's a tool for this? It would make it a lot easier than searching the colours manually and extracting the styles.
I would create a dynamic file in PHP and specify the header as CSS:
header('Content-Type: text/css');
Use echo to add lines to the current CSS file! Make variables for all the colors you want. You can pass the selected colors with GET or POST requests. Notice that if you browser-cache the CSS files you should exclude the dynamic ones!
How can we know if any website is using Sass and Compass for CSS?
That's a though one, but I would take a look at the CSS files, IF the developers forgot about changing the output, you'll be able to spot the file names and line numbers of the source files.
If not, look for uncommon patterns in the CSS output, for instance SASS makes nesting very easy to do, so a selector could look like this in the CSS (you would never hand-write this long selectors)
div#wrapper div#container ul#myId li a { color: blue; }
div#wrapper div#container ul#myId li.sass a { color: red; }
But would be look like this in SASS source file (no repetition, easy to getaway with)
div#wrapper {
div#container {
ul#myId {
li {
a { color: blue; }
&.sass {
a { color: red; }
}
}
}
}
}
Also, look for lengthy class combinations, those come from using the #extend directive, that would look like this:
.button, .button1, .button-submit, .button-add-to-cart, .button-signup, .button-register {
display: inline-block;
}
Another good idea is to look in the source of CSS3 generated buttons, usually developers only care for Firefox, Safari, Chrome and IE, but a SASS generated output will be REALLY verbose with a lot of vendor prefixes, including ones for Opera.
Good luck!
if the developer forgot to compile for production or minify the .css, than you should still be able to see the automatically inserted comments that point back to the original source, like:
/* line 22, ../../../../../Ruby193/lib/ruby/gems/1.9.1/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
.selector {
bla: 123;
}
or
/* line 5, sass/large/_common.scss */
.selector {
bla: 123;
}
I'm trying to make a universal CSS layout for a large application my companies working on. I ran into a problem while trying to style all asp:label's to look a certain way. I was having the same problem with buttons but I figured that out:
input[type="submit"] {
background: red;
}
that will make all the buttons have a red background....
So, does anyone know how to style asp:label's ??? Everything that I've attempted is listed below, but to no avail:
label {
background: red;
}
asp:label {
background: red;
}
input[type="label"] {
background: red;
}
Since a label just outputs a span, I would imagine that it's like this:
span { background-color:Red; }