Jump to content

CSS positioning issues


phunni
 Share

Recommended Posts

The site I am trying to fix

 

If you view the above site in IE - it should look fine. If you view it in Mozilla firefox (as I tend to try and do) you will notice that the top section and the copyright are well out of position.

 

I need to figure out a way of fixing it so that it works in IE and mozilla perfectly. I tried adding an alignment of center to the relevant <div>s - but this didn't work

 

Any ideas?

Link to comment
Share on other sites

Thanks Paul - you're my CSS Guru!

 

It still looks fine in IE and much better in mozilla. The sections don't line up properly in mozilla. I'll try and figure out why not if I get a chance (although if someone can spot it straight away... ;) )

 

:D

Link to comment
Share on other sites

if I were you :)

I would use margin-left: *number of pixels*; margin-right: auto; width *number of pixels*

in all the div's that you have ... then it should line up fine ;)

 

*just a guess :P

Link to comment
Share on other sites

  • 1 month later...
Guest Adriano

Have you tried adding a doctype to your documents? I think Moz is putting you into "quirks-mode" rendering, which is what it does when it detects an incorrect or non-existent doctype. You can find a doctype list here at w3c.org, and a document to help you choose one of them here.

 

I also noticed that your html has two < head> elements, one inside the < body> element... That can't be right (as of 03/may/2004).

Edited by Adrianovaroli
Link to comment
Share on other sites

looks ok or what do you want exactly?

 

Is this spelling corect (sorry :))?:

 

proffesionals

 

Be sure to put quotes (") around attribuet-names:

class=row -> class="row" is one case

 

some problems the html validator gives:

 

http://www.mirror.ac.uk/services/validator...jsp&ss=#line-36

 

 

Below are the results of attempting to parse this document with an SGML parser.

 

* Line 1, column 1:

 

 

^

 

Error: Missing DOCTYPE declaration at start of document (explanation...)

* Line 11, column 97:

 

... "/images/proconstruct.gif" width="200" height="59"><br>

^

 

Error: required attribute "ALT" not specified

* Line 36, column 22:

 

<p><form name="performSearch" method="post" action="/performSe ...

^

 

Error: there is no attribute "NAME"

* Line 87, column 5:

 

<head>

^

 

Error: document type does not allow element "HEAD" here

 

Sorry, this document does not validate as HTML 4.0 Transitional.

 

If you use CSS in your document, you should also check it for validity using the W3C CSS Validation Service.

Source Listing

 

Below is the source input I used for this validation:

 

0: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">

1:

2: <html>

3: <head>

4: <title>Welcome to the Construction Portal</title>

5: <link rel="stylesheet" type="text/css" href="/construction.css">

6: </head>

7:

8:

9:

10: <body>

11: <div id="leftcontent" align="center" ><img src="/images/proconstruct.gif" width="200" height="59"><br>

12: <br>

13: <div id="menu"><a href="/index.jsp">Home</a> | <a href="/register.jsp">Register</a> | <a href="/admin/administer.jsp">Administration</a>

14: </div>

15: </div>

16: <div id="footer"><br></div>

17:

18: <div id="portal">

19:

20: The Construction Portal is a directory of proffesionals who work within the

21: construction industry. Anyone can search the directory for companies by their name,

22: region or field of expertise.

23:

24: <p>We are currently offering six months free registration, <b>without any obligation to

25: sign up after that time.</b>

26:

27: If you are interested in taking advantage of this offer, please feel free to

28: <a href="/register.jsp">register</a>

29:

30:

31:

32:

33:

34: <p>

35: <!-- <div class="form" >-->

36: <p><form name="performSearch" method="post" action="/performSearch.do;jsessionid=DF92CFD160DA6D1AB0DC38FC198D5F3D">

37:

38:

39: Please perform a search based on some or all of the following: <br>

40: <b>All search fields are optional - use at least one, or up to three criteria</b><br>

41: <p>

42: <div class=row>

43: <span class=label>Company Name: </span>

44: <span class=formw><input type="text" name="company" value=""></span>

45: </div>

46:

47: <div class=row>

48: <span class=label>Business Type: </span>

49: <span class=formw>

50: <select name="type"><option value="Please Select...">Please Select...</option>

51: <option value="Architect">Architect</option>

52: <option value="Building Contractor">Building Contractor</option>

53: <option value="Buildings Surveyor">Buildings Surveyor</option>

54: <option value="Quantity Surveyor">Quantity Surveyor</option>

55: <option value="Valuation Surveyor">Valuation Surveyor</option>

56: <option value="Structural Engineer">Structural Engineer</option>

57: <option value="Civil Engineer">Civil Engineer</option>

58: <option value="Acoustic Consultant">Acoustic Consultant</option>

59: <option value="Building Services Consultant">Building Services Consultant</option>

60: <option value="Planning Supervisor">Planning Supervisor</option></select>

61: </span>

62: </div>

63:

64: <div class=row>

65: <span class=label>Region: </span>

66: <span class=formw>

67: <select name="region"><option value="Please Select...">Please Select...</option>

68: <option value="South East">South East</option>

69: <option value="South West">South West</option>

70: <option value="Midlands East">Midlands East</option>

71: <option value="Midlands West">Midlands West</option>

72: <option value="North East">North East</option>

73: <option value="North West">North West</option>

74: <option value="West Scotland">West Scotland</option>

75: <option value="East Scotland">East Scotland</option>

76: <option value="North Wales">North Wales</option>

77: <option value="South Wales">South Wales</option>

78: <option value="Nationwide">Nationwide</option></select>

79: </span>

80: </div>

81: <div class=row>

82: <span class=formw><input type="submit" value="search"></span>

83: </div>

84: </form>

85:

86: </div>

87: <head>

88: <title>Welcome to the Construction Portal</title>

89: <link rel="stylesheet" type="text/css" href="/construction.css">

90: </head>

91:

92:

93:

94:

95:

96: <div id="copyright" align="center" >© Red Fruit IT Limited</div>

97:

98:

99: </body>

100: </html>

 

You shoudl describe it as html 4.0.1 transitional, maybe that helps for the name-attribute. I have use dteh attribute too and I believed it was marked valid for me. It's mayeb because of the prvious errors. Here was my doctype ofr 4.0.1 transitional:

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

 

 

Note(personal stuff): When I made my page in css. I had to inverse problem :). I checked it using mozilla (and konqueror), but when I sometimes checked in IE, I saw it wasn't correct. Sometimes it where syntacatical errors, else stuff that IE didn't support .

Link to comment
Share on other sites

xhtml is a job I intend to get around to fairly soon. There shouldn't be much to it as I've tried (on some of the pages at least) to build with that in mind anyway. I'm an XML man in my job anyway - so I've always had inclinations in that direction

 

Thanks for the tips - I'll try them out today!

 

BTW - the URL for the site is now http://www.proconstruct.co.uk - the previous URL was the testing site - but I'm almost ready for launch now...

Link to comment
Share on other sites

Adding a doctype has made no difference unfortuantely - in fact it broke the site in IE!.

 

I'm not sure the site will ever be fully valid html simply because of the name attribute in the form tag. This is added because my form validation and handling is done by Jakarta Struts and I think the name attribute is required for that.

 

I believe the CSS is valid

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...