Solved

format div box

Posted on 2014-12-14
3
106 Views
Last Modified: 2014-12-29
HI, I want to format text inside the div so it looks more professional with some sort of  background,
In CSS do I need to add further div for each of the text outputs? I a using php to display some data.
I am after a css solution.

 <div class="dashbox">
           <div  class="dashhead">
               Income
           </div>
           
            <?php echo 'Timesheet Income';
             echo '<br><br>Current Pay Period'. $ test;
             echo '<br>Last Pay period';
            echo '<br><br>Fortnight';
             echo '<br>Month';
           
            ?>
        </div>


.dashbox {
    height:300px;
    width:300px;
    border:1px solid blue;
   
   
}
0
Comment
Question by:jagguy
3 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 40499473
so it looks more professional with some sort of  background
How so?
0
 

Author Comment

by:jagguy
ID: 40499806
I just need this to look better and is there an easy way to format the text without another div
0
 
LVL 43

Accepted Solution

by:
Chris Stanyon earned 500 total points
ID: 40500462
That's a very subjective question because what looks good to one person looks awful to another. Having said that, CSS is only responsible for styling the content, so getting your content right is the first step. You look like you about to catch DIVitis! Don't forget, you can style all the HTML tags, not just DIVs:

Have a look at this:

<div class="dashbox">
   <h1>Income</h1>
   <dl>
      <dt>Timesheet Income</dt>
      <dd>Current Pay Period: <?php echo $test ?></dd>
      <dd>Last Pay Period: </dd>
      <dd>Fortnight: </dd>
      <dd>Month: </dd>
   </dl>
</div>

Open in new window


Now you can use CSS to style the elements exactly as you like:

.dashbox { height:300px; width:300px; border:1px solid blue; }
.dashbox h1 { color: red; margin-bottom: 1em; font-size: 2em; }
.dashbox dt { font-weight:bold; color: green; font-size: 1.2em; }
.dashbox dd { font-style: italic; }

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
This article discusses four methods for overlaying images in a container on a web page
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now