Welcome Guest, Not a member yet? Register   Sign In
the div tag
#2

(This post was last modified: 03-05-2016, 08:40 AM by Wouter60.)

Your question is more about html than about CodeIgniter, since CI is a so-called back-end framework.
The html helper, though, provides an easy way to standardize some html output, but it has no function for the div element.
The basic use of div is to divide your page into different sections, with a specific lay-out.
You can use the style attribute to give one single div the lay-out you want, but in most cases it's better to use css.

Example:
Code:
<div style="background-color: green; border: 2px solid black; margin: 6px 0;">Blabla</div>

The output is the text blabla in a green box with a black border. Above and below the box there's a margin of 6 pixels; left and right there's no margin.

You can reach the same, if you put the attributes in a css file, like this:
Code:
.greendiv { background-color: green; border: 2px solid black; margin: 6px 0; }

Then, in your view, to make a green div, just write this:
Code:
<div class="greendiv">Blabla</div>

That way, it's much easier to repeat the same lay-out on the same page or any other page, as long as you load the css file in the html "<head>" section.
Reply


Messages In This Thread
the div tag - by Mr. Dee - 03-05-2016, 05:00 AM
RE: the div tag - by Wouter60 - 03-05-2016, 08:38 AM



Theme © iAndrew 2016 - Forum software by © MyBB