473,405 Members | 2,282 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Beginner questions regarding CSS

Hi everybody,

A few days ago I decided to get my site validated, so I have begun to clean
up the first page to get an impression of what I should and should not do.

To be able to get the site validated, I have to get rid of a lot of old
style layout (tables, etcetera...), but I'd very much like to keep the
original look and feel of the site.

I have literally spent the entire evening working on the title and menu part
of the site - I'm a software developer, not a designer, and my knowledge of
css is increasing, yet very limited at the moment.

So here I am with a few questions: the original site can be seen in the link
below, the new version can be found here:
http://jcsnippets.atspace.com/strictindex.html
and a link to the stylesheet can be found here:
http://jcsnippets.atspace.com/css/strictstyle.css

First of all, I'd like to center the subtitle vertically - even spacing
below and above. The only way I found to accomplish this, is adding p or br
tags above and below, but I really don't think that is an option.

Second, I'd like to spread out the menu over the entire width of the page -
again, I have no idea how to accomplish this.

Every little hint that can push me towards a clean result is welcome!

Thanks in advance,

JayCee
--
http://jcsnippets.atspace.com/
a collection of source code, tips and tricks
Mar 6 '06 #1
13 1401
Mon, 06 Mar 2006 22:31:50 GMT from jcsnippets.atspace.com
<ad***@jcsnippets.atspace.com>:
First of all, I'd like to center the subtitle vertically - even spacing
below and above. The only way I found to accomplish this, is adding p or br
tags above and below, but I really don't think that is an option.


Style it with padding-top and padding-bottom.

I'm a little concerned about things I see in your source like <p />.
I'm no XHTML expert, but I hope someone who is will comment.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Why We Won't Help You:
http://diveintomark.org/archives/200..._wont_help_you
Mar 7 '06 #2
Stan Brown <th************@fastmail.fm> wrote in
news:MP************************@news.individual.ne t:
Mon, 06 Mar 2006 22:31:50 GMT from jcsnippets.atspace.com
<ad***@jcsnippets.atspace.com>:
First of all, I'd like to center the subtitle vertically - even
spacing below and above. The only way I found to accomplish this,
Style it with padding-top and padding-bottom.

I'm a little concerned about things I see in your source like <p />.
I'm no XHTML expert, but I hope someone who is will comment.


I'm no expert but do know enough that what you show there is definitely
not correct. In HTML, <p> may or may not be closed by </p>, the end
tag being optional. I suspect due to not having to have a closing tag,
someone new to learning XHTML could assume <p> is an empty element and
try to use the closing / as you've shown and is correct for closing an
empty element such as <br />. In XHTML, only <p>text.</p> would be
correct for a paragraph.

--
Stan McCann, "Uncle Pirate" http://stanmccann.us/
Webmaster, NMSU at Alamogordo http://alamo.nmsu.edu/
Now blocking Google Grouper posts and replies.
http://blinkynet.net/comp/uip5.html
Mar 7 '06 #3
Hello,
First of all, I'd like to center the subtitle vertically - even spacing
below and above. The only way I found to accomplish this, is adding p or br
tags above and below, but I really don't think that is an option.
These styles should help:

padding-top:10px;
pading-bottom:10px;
margin-top:10px;
margin-bottom:10px;
valign:top;

Second, I'd like to spread out the menu over the entire width of the page -
again, I have no idea how to accomplish this.


width:100%;

Let me know if that helps.

Chris S.

Free Web Design Tools
http://www.impliedbydesign.com/free-...e-scripts.html

Mar 7 '06 #4
<go****@impliedbydesign.com> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
Hello,
First of all, I'd like to center the subtitle vertically - even spacing
below and above. The only way I found to accomplish this, is adding p or br tags above and below, but I really don't think that is an option.


These styles should help:

padding-top:10px;
pading-bottom:10px;
margin-top:10px;
margin-bottom:10px;
valign:top;


All I achieve by adding these is resizing the top div - which is not what I
want. Even if I get the text to move down, it looks like it's half inside
the div, half outside.

I'd like to get the big title in the upper half, and the second text
centered vertically in what's left.
Second, I'd like to spread out the menu over the entire width of the page - again, I have no idea how to accomplish this.


width:100%;

Let me know if that helps.


Alas, width: 100% seems to move the text a bit to the right, but it's not
spreading over the entire width.

Best regards,

JayCee
--
http://jcsnippets.atspace.com/
a collection of source code, tips and tricks
Mar 7 '06 #5
"Stan McCann" <me@stanmccann.us> wrote in message
news:Xn************************@216.234.192.142...
Stan Brown <th************@fastmail.fm> wrote in
news:MP************************@news.individual.ne t:
Mon, 06 Mar 2006 22:31:50 GMT from jcsnippets.atspace.com
<ad***@jcsnippets.atspace.com>:
First of all, I'd like to center the subtitle vertically - even
spacing below and above. The only way I found to accomplish this,

Style it with padding-top and padding-bottom.

I'm a little concerned about things I see in your source like <p />.
I'm no XHTML expert, but I hope someone who is will comment.


I'm no expert but do know enough that what you show there is definitely
not correct. In HTML, <p> may or may not be closed by </p>, the end
tag being optional. I suspect due to not having to have a closing tag,
someone new to learning XHTML could assume <p> is an empty element and
try to use the closing / as you've shown and is correct for closing an
empty element such as <br />. In XHTML, only <p>text.</p> would be
correct for a paragraph.


The <p /> validates as HTML 4.01 strict, but the <hr /> was indeed an error.

Validation already pointed this one out, but thanks anyway!

JayCee
--
http://jcsnippets.atspace.com/
a collection of source code, tips and tricks
Mar 7 '06 #6
go****@impliedbydesign.com wrote :
Hello,

[snipped]
These styles should help:

padding-top:10px;
pading-bottom:10px;
margin-top:10px;
margin-bottom:10px;
valign:top;


I assume you meant vertical-align: top and not valign. In any case, you
should not be using 5 css declaration to position the element. There is
such a thing as over-declaring, over-defining and over-constraining when
using CSS.

Gérard
--
remove blah to email me
Mar 7 '06 #7
Deciding to do something for the good of humanity,
"jcsnippets.atspace.com" <ad***@jcsnippets.atspace.com> declared in
comp.infosystems.www.authoring.stylesheets:
The <p /> validates as HTML 4.01 strict,


It may be valid, but it's still not correct. It actually means the same
as <p></p>> though no major browser will treat it that way.

Anyway an empty paragraph simply doesn't make sense unless you're just
using it for spacing, which you shouldn't be as that's what CSS is for.

--
Mark Parnell

Now implementing http://blinkynet.net/comp/uip5.html
Mar 7 '06 #8
"Mark Parnell" <we*******@clarkecomputers.com.au> wrote in message
news:5f**************@markparnell.com.au...
Deciding to do something for the good of humanity,
"jcsnippets.atspace.com" <ad***@jcsnippets.atspace.com> declared in
comp.infosystems.www.authoring.stylesheets:
The <p /> validates as HTML 4.01 strict,
It may be valid, but it's still not correct. It actually means the same
as <p></p>> though no major browser will treat it that way.


Ok, now I'm totally confused - everyone I spoke to since I started my
website gave me the advice to validate the site. I'm not argueing that it is
correct, but why would this be allowed if it is not correct? I find that
strange (on the part of the validator) to say the least!

Anyway, the situation will resolve itself (read on please).
Anyway an empty paragraph simply doesn't make sense unless you're just
using it for spacing, which you shouldn't be as that's what CSS is for.


Agreed - which was part two of my original question. I'd like to get rid of
these empty paragraphs and put it all in CSS.

Thanks for your help,

JayCee
--
http://jcsnippets.atspace.com/
a collection of source code, tips and tricks
Mar 7 '06 #9
Deciding to do something for the good of humanity,
"jcsnippets.atspace.com" <ad***@jcsnippets.atspace.com> declared in
comp.infosystems.www.authoring.stylesheets:
Ok, now I'm totally confused - everyone I spoke to since I started my
website gave me the advice to validate the site.
That advice wasn't necessarily bad, but you need to understand what
validation actually is and does before it becomes truly useful.
I'm not argueing that it is
correct, but why would this be allowed if it is not correct?
It is technically *valid* - it conforms to the DTD - but it still isn't
correct. There is a difference.
I find that
strange (on the part of the validator) to say the least!


http://www.cs.tut.fi/~jkorpela/html/validation.html

--
Mark Parnell

Now implementing http://blinkynet.net/comp/uip5.html
Mar 7 '06 #10
jcsnippets.atspace.com wrote:
"Mark Parnell" <we*******@clarkecomputers.com.au> wrote
Anyway an empty paragraph simply doesn't make sense unless you're
just using it for spacing, which you shouldn't be as that's what CSS
is for.


Agreed - which was part two of my original question. I'd like to get
rid of these empty paragraphs and put it all in CSS.


Drop the empty paragraph and put a margin-bottom of some small amount of
em, on the preceding element.

..makespace { margin-bottom: 1.5em; }

<h2 class="makespace">A heading goes here.</h2>
<div>whatever else follows that you want a bit lower...</div>

--
-bts
-Warning: I brake for lawn deer
Mar 8 '06 #11
Tue, 07 Mar 2006 22:47:49 GMT from jcsnippets.atspace.com
<ad***@jcsnippets.atspace.com>:
Ok, now I'm totally confused - everyone I spoke to since I started my
website gave me the advice to validate the site. I'm not argueing that it is
correct, but why would this be allowed if it is not correct? I find that
strange (on the part of the validator) to say the least!


What they're telling you is that it's syntactically valid, so it has
a meaning, but the meaning is not what you think (and not what you
want).

If you want vertical space, you should use CSS to put a bottom-margin
on the preceding block element or a top-margin on the following one.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Why We Won't Help You:
http://diveintomark.org/archives/200..._wont_help_you
Mar 8 '06 #12
On Tue, 07 Mar 2006 22:47:49 GMT, "jcsnippets.atspace.com"
<ad***@jcsnippets.atspace.com> wrote:
"Mark Parnell" <we*******@clarkecomputers.com.au> wrote in message
news:5f**************@markparnell.com.au...
Deciding to do something for the good of humanity,
"jcsnippets.atspace.com" <ad***@jcsnippets.atspace.com> declared in
comp.infosystems.www.authoring.stylesheets:
> The <p /> validates as HTML 4.01 strict,


It may be valid, but it's still not correct. It actually means the same
as <p></p>> though no major browser will treat it that way.


Ok, now I'm totally confused - everyone I spoke to since I started my
website gave me the advice to validate the site. I'm not argueing that it is
correct, but why would this be allowed if it is not correct? I find that
strange (on the part of the validator) to say the least!


As that's the very first question that these groups helped me with, many
years ago, maybe I should make an effort.

HTML is officially an implementation of SGML, and the validators
validate according to the SGML rules. The slash is in this case an SGML
shorthand terminating the element, and the '>' is treated as a piece of
textual content.

However the first browsers did not properly implement SGML, so no-one
was able to use this shorthand, and no mainstream browsers (AFAIK) ended
up implementing it. And so very few web authors are aware of it.

Validation is like a spelling-checker: a valuable process (especially
when working in a somewhat unfamiliar language) which will catch a lot
of errors. But if you mistype 'form' instead of 'from', a
spelling-checker will not help you, and nor will a validator in similar
cases.

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Mar 8 '06 #13
"Stephen Poley" <sb******************@xs4all.nl> wrote in message
news:sv********************************@4ax.com...
<snipped>

Thanks everyone - I'm beginning to see the light here :)

JayCee
--
http://jcsnippets.atspace.com/
a collection of source code, tips and tricks
Mar 8 '06 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

44
by: lester | last post by:
a pre-beginner's question: what is the pros and cons of .net, compared to ++ I am wondering what can I get if I continue to learn C# after I have learned C --> C++ --> C# ?? I think there...
7
by: Rensjuh | last post by:
Hello, does someone have / know a good C++ tutorial for beginnners? I would prefer Dutch, but English is also fine. Hoi, heeft / kent iemand nog een goede C++ tutorial voor beginners? Het liefste...
8
by: Mike | last post by:
Hello, I have a few rather urgent questions that I hope someone can help with (I need to figure this out prior to a meeting tomorrow.) First, a bit of background: The company I work for is...
12
by: Blaze | last post by:
I am doing the first walk through on the Visual Studio .Net walkthrough book to learn a little about programming. I am having issues with the first tutorial not running correctly. It seems that...
12
by: Joshua Rulz | last post by:
Hi, i want to learn to program im quite skilled with computers and want to learn c++. is there anyone who can teach me or tell me a good website to learn it? all replies will be appreciated.
2
by: Chris | last post by:
Hi all, I've recently started learning ASP.Net and have a few questions mostly regarding best practice. As postback uses JS is it normal practice to check if the browser supports/has JS...
6
by: sstallman | last post by:
I have been tasked with creating a database in Access for a Mortgage Lending office. My boss wants a database that can be placed on the office server. He wants all of the lending officers to be...
1
by: Robert J. Bonn | last post by:
I'm trying to set up a contact list in MS Access 97. I've looked through a reference book and the program's help screens, but the light bulb isn't quite coming on for me. If one of you could take...
22
by: ddg_linux | last post by:
I have been reading about and doing a lot of php code examples from books but now I find myself wanting to do something practical with some of the skills that I have learned. I am a beginner php...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.