Solved

format div box

Posted on 2014-12-14
3
102 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 42

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article discusses four methods for overlaying images in a container on a web page
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…

758 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

23 Experts available now in Live!

Get 1:1 Help Now