Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8
This is the forum to discuss the Wrox book Beginning ASP.NET 2.0 by Chris Hart, John Kauffman, David Sussman, Chris Ullman; ISBN: 9780764588501
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 22nd, 2006, 05:22 PM
Authorized User
 
Join Date: Feb 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default CSS formatting

Hi,

I am experiencing some problems when experimenting with formatting via a CSS.

I have a table element:

<table class="Table_Small" style="position: relative">
  <tr >
    <td >
        <asp:Label ID="Label4" runat="server" Style="position: relative" Text="First Name"></asp:Label><br />
        <asp:TextBox ID="txtFirstName" runat="server" Style="position: relative"></asp:TextBox>
     </td>
     <td></td>
   </tr>
</table>

Here is the corresponding CSS (StyleSheet.css) entry:

.Table_Small
{

    LEFT: 0px;
    WIDTH: 550px;
    COLOR: Black;
    POSITION: relative;
    TOP: 0px;
    BACKGROUND-COLOR: White;
    font-size: small;
    text-align: left;
    left: 0px;
    position: relative;
        top: 0px;
}

I have the following in the MasterPage.aspx:
<link rel="stylesheet" type="text/css" href="StyleSheet.css" />


The CSS formatting is applied when I switch to design view. However, when I open the page in my browser, the formatting is not applied. For example, I have a few textboxes in the table cells. In design view, they are aligned at the left side of the table cells, but in the browser, they are centered in the table cells. Also, even though I have specified a background color of white for the table, when I run the project, the background is blue, which is the background color of my master page.

I have not specified any formatting for the table rows or cells.

Can anyone explain to me why this approach will not work?

Thanks,

Mike
 
Old March 23rd, 2006, 01:04 PM
Wrox Author
 
Join Date: Jun 2004
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Mike,
         I think it's not finding your style sheet. Where is your style sheet with regards to a) your master and b) the page with the code in?

Chris

Chris Ullman
Programmer/Technical Author
http://www.cuasp.co.uk
 
Old March 24th, 2006, 10:55 AM
Authorized User
 
Join Date: Feb 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Chris,

The stylesheet is in the root directory of the project, as is the master page. The content page with the table is in a sub-directory of a folder that is itself a sub-directory of the project folder.

To make it clearer, here is the file layout:

-WebApplication1 (main project directory)
  -MasterPage.master
  -StyleSheet.CSS
  -UserPages (sub-directory)
    -DirectorPages (sub-directory)
      -TableTestCSS.aspx (content page w/ table)

Thanks,

Mike
 
Old April 10th, 2006, 09:16 AM
Registered User
 
Join Date: Apr 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Not sure if you've fixed the problem as the last post was a while ago but i have a suggestion.
In your CSS file, are the different elements in the order that they are called upon on the master page?

e.g on the master page:
div class="header" above
div class="footer".
and in the css file
div.header{ above
div.footer{

I had this problem and it was fixed by ensuring the above rule was followed. Still catches me out though :)
Hope this helps.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Css formatting problem beetle_jaipur CSS Cascading Style Sheets 2 June 5th, 2009 07:16 AM
CSS HELP:! CSS EXPANDIBLE BACKGROUND FOR TITLE phpuser2000 CSS Cascading Style Sheets 2 December 19th, 2007 12:36 AM
Rich's new CSS book: Beginning CSS 2nd Edition jminatel BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 0 June 15th, 2007 11:55 AM
Formatting php with css Hylsan Pro PHP 3 December 25th, 2006 07:16 AM
Formatting syrex XSLT 2 November 5th, 2005 08:23 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.