CSS questions |
Hi,
I am new to PHP and CodeIgniter, I have quite a lot to learn . I started using CSS, but I fell I can make better use. Here is what I am talking about: Code: .row_col1{ As you can see, the only difference between the three is the color. I would like to create only one style and add the color when I add rows, but that doesn't work unfortunately. I tried something like this: Code: $row1 = [ Thing is the background-color was not applied. What am I doing wrong ? Thanks
<div class = "row_without_color" style="background-color = yellow; ..."></div>
Try
$row1 = [ 'data' => 'Some text', 'class' => 'row_without_color', 'style' => 'background-color: yellow;' ];
[Just a programmer] [/Just a programmer]
You can also try this:
Code: .row_col1, .row_col2, .row_col3 {
Hi Joel and Wouter60,
my mistake was: Code: $row1 = [ But that worked: Code: $row1 = [ Joel suggestion works fine also. This is what I implemented, because as far as I know it is recommended to use css (and css properties) over HTML. Thanks
You can also combine multiple css classes, seperated by a space character.
E.g. css file: Code: .row_without_color { controller (or view) PHP Code: $row1 = array(
Wouter 60,
another interesting way to do it . I was wondering if it's possible to define row_red as row_without_color plus the color, something like row_red would inherit from row_without_color. I googled but didn't find something I can understand. I have questions about CSS like:
class = "row_without_color{space}row_red" combines the two!
The dot before the name tells css to define a class. You can use the name of the class to implement the corresponding style. If you put a # before the name (in css), then you can assign the style to an element with that id. Keep in mind that you can only have one element with a unique id on a web page, where classes can be applied many times. You can find tons of information about css here: http://www.w3schools.com/css/default.asp
(08-31-2016, 06:32 AM)planteg Wrote: Hi Joel and Wouter60, Woah! That's nice. I don't have any idea about bgcolor attribute (it's because I'm more on backend ). I googled bgcolor if it has a compatibility issue but seems that there is no problem of using it. It is very simple instead of using style="background~~" attribute. Thanks for the share!
[Just a programmer] [/Just a programmer]
|
Welcome Guest, Not a member yet? Register Sign In |