Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 445977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T21:25:29+00:00 2026-05-12T21:25:29+00:00

I want to define the style of Div based on a CSS file. The

  • 0

I want to define the style of Div based on a CSS file. The CSS code I have written is:

.body
{
    text-align: center;
    padding: 1px;
    margin: 1px;
    color: black;
    background-color:lightgrey;
}

I want the background of each Div section to be light-grey. What’s wrong with the above code?

Edited:

This is my HTML code. I changed the Div class as suggested below, but it is not working. Please also check whether the Link tag contains path correctly or not. The CSS file is located in a Lib folder, up-one-level.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <title>Add/Update Political Party</title>
        <link rel="stylesheet" href=".\Lib\entryformstyle.css" type="text/css"/>
    </head>
    <body>
        <div id="sectionEntryForm" class="div">
            <table id="tblEntryForm" cols="2">
                <tr>
                    <td colspan="2" align="center">Add/Update Political Party</td>
                </tr>
                <tr>
                    <td>Party full name:</td>
                    <td><input id="inPartyFullName" name="inPartyFullName" accept="text/plain" maxlength="80" class="inputBoxStyle"></td>
                </tr>
                <tr>
                    <td>Party short name (initials):</td>
                    <td><input id="inPartyShortName" name="inPartyShortName" accept="text/plain" maxlength="80" class="inputBoxStyle"></td>
                </tr>
            </table>
        </div>
    </body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T21:25:30+00:00Added an answer on May 12, 2026 at 9:25 pm

    ALL DIVs:

    div
    {
        text-align: center;
        padding: 1px;
        margin: 1px;
        color: black;
        background-color:lightgrey;
    }
    

    DIVs with class “body”:

    div.body
    {
        text-align: center;
        padding: 1px;
        margin: 1px;
        color: black;
        background-color:lightgrey;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a generic css style defined for table,tr,td in external css file as
So I've got style.css which defines all my CSS classes. But I want to
I have an HTML page with a pink background image. I want to define
I have a div container and have defined its style as follows: div#tbl-container {
I have problem with getting css padding-left value with jQuery, when css is not
In my CSS, I defined the #error div as: #error { border-width:1px; border-style:solid; border-color:
I want to override some style provided in struts/xhtml/style.css. One of them is label
I have a Google Instant style jQuery search script that queries a PHP file
I have a Google Instant style jQuery search script that queries a PHP file
Say you had a Css style defined below . div { background: url(themes/default/images/backgrounds/lh-navigation.png) repeat-x;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.