473,416 Members | 1,733 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,416 software developers and data experts.

Help with <p> margins inside <div> please!

hi again all,

i am still working on the website as mentioned in earlier threads and
have hit another snag...

http://awash.demon.co.uk/index.php

http://awash.demon.co.uk/vd.css

the php is pulling a name and placing it under the thumbnail (the text is
red) in a <p>. i have successfully set the colour to red through the
stylesheet, however, no notice is being taken of:

margin-top:0.2em;

or, indeed when i was playing about, this:

font-size:80%;

can anybody please let me know what i'm doing wrong? i'm guessing these
formatting instructions are being superceded by something else. if that
is the case, i have no idea what!

thanks in advance for any pointers. oh, and feel free to pull apart the
rest of the site for bad practice, i'm open to comments to improve the
code.

cheers
--
slim
Jul 20 '05 #1
8 5116
|| name | slim <sl**@antiCorp.invalid> | message |
|| news:Xn**************************@38.144.126.106: ||
hi again all,
<snip>
http://awash.demon.co.uk/index.php

http://awash.demon.co.uk/vd.css
<snip>
thanks in advance for any pointers. oh, and feel free to pull apart
the rest of the site for bad practice, i'm open to comments to improve
the code.

cheers
--
slim


not to worry - i fixed the <p> margin problem using a different
technique. the other comments would still be appreciated if you have 2
mins to spare :)
--
slim
Jul 20 '05 #2
slim <sl**@antiCorp.invalid> wrote:
feel free to pull apart the
rest of the site for bad practice, i'm open to comments to improve the
code. XHTML 1.0 Transitional
Using XHTML is silly, Transitional is for legacy documents, newly
authored documents should use Strict.
<div id="header"><h1>
Why the div wrapper? H1 is a block level element, styles you have
attached to the wrapper div can be added to the H1.
<div id="navigation">
That's a list.
<p>
<span class="current">latest</span>
That's not a paragraph.
<input type="text" name="criteria" style="width:6em;">
Move the inline css to the external stylesheet.
&nbsp;
Margins should be specified via css.
<div id="contentwrap">
<div id="rightcol">
<h2>latest tees</h2> <div class="teeblock_outercontainer">
Div/span soup.
<div class="spacer">&nbsp;</div>
Again, margins should be specified with css.
<img src='./images/tees/thumbs/t_shitwizard.jpg' class='tee_thumbnail' alt='you are the shitwizard!'/>


The images should not be resized by the browser, and definitely not by
specifying the desired dimensions in css.

--
Spartanicus
Jul 20 '05 #3
Spartanicus wrote:
slim <sl**@antiCorp.invalid> wrote:

feel free to pull apart the
rest of the site for bad practice, i'm open to comments to improve the
code.


XHTML 1.0 Transitional

Using XHTML is silly, Transitional is for legacy documents, newly
authored documents should use Strict.


It seems to me that transitional is useful so that one may apply a
background image and colors for browsers that cannot see the style
sheet. How is this incorrect for new documents?

John Moyer
http://www.rsok.com/~jrm/
Jul 20 '05 #4
John Moyer wrote:
It seems to me that transitional is useful so that one may apply a
background image and colors for browsers that cannot see the style
sheet.
Yes, transitional can accomplish that, assuming the client is capable of
color and images.
How is this incorrect for new documents?


New documents should not make assumptions about the capabilities of the
client beyond assuming reasonably conforming html parsing, and thus
should send only marked up content in the html documents. Styles should
be presented separately from the content, to allow visitors to alter the
presentation if the need or desire arises. And styling info should be in
a separate file so that clients that either cannot use or do not want it
do not need to download it.

--
Brian (remove "invalid" from my address to email me)
http://www.tsmchughs.com/
Jul 20 '05 #5
|| name | Spartanicus <me@privacy.net> | message |
|| news:ns********************************@news.spart anicus.utvinternet.i
|| e: ||
slim <sl**@antiCorp.invalid> wrote:
feel free to pull apart the
rest of the site for bad practice, i'm open to comments to improve the
code.

XHTML 1.0 Transitional


Using XHTML is silly, Transitional is for legacy documents, newly
authored documents should use Strict.


i tried to change this, checked it out in 3 browsers and found a total
mess in ie6 & opera7.1. although, i think that may have been me tinkering
before. i will leave this as is until i sort out my current problems and
then change it.
<div id="header"><h1>


Why the div wrapper? H1 is a block level element, styles you have
attached to the wrapper div can be added to the H1.


when i take away the containing div, the header does not accept all the
style attributes i give it and does not display the same. for example, in
firefox, there is a gap between the bottom of header.jpg and the bottom
border. is there some part of <h> tags that overrules styles i apply?
<div id="navigation">


That's a list.


good point. that's kind of done, except i'm still using a div to frame
it, or <ul> won't take the style attributes i need to keep the design the
same.
<p>
<span class="current">latest</span>


That's not a paragraph.


also fixed, thanks.
<input type="text" name="criteria" style="width:6em;">


Move the inline css to the external stylesheet.


have done, thank you.
&nbsp;


Margins should be specified via css.


this was used as part of a fix i found whilst browsing: i want to display
the dotted boxes containing each t-shirt in a row until they need to
break for a new line, this trick was recommended to fix the fact that
they float:left and so occupy no space.

is there a better way to do this? i am currently using a slightly
different version of the same workaround, i'd like to be able to achieve
the boxes displaying as i describe legitimately if possible.
<div id="contentwrap">
<div id="rightcol">
<h2>latest tees</h2>

<div class="teeblock_outercontainer">


Div/span soup.


too many? the contentwrap div was used to fix a bug (which has now
reappeared) where the right column was appearing after the left column
vertically.

the rightcol div is then defined to house the various parts 10em across
so as to meet the leftcol - is this not necessary then?

and finally, the divs used to construct the t-shirt dotted boxes were the
only way i could see to achieve the look i wanted without using a table -
would you be able to suggest a better way of achieving that style with
cleaner code?

i'm new(ish) to this and willing to learn, but i'm kind of putting things
together as i pick it up, so it's not always the best approach.
<div class="spacer">&nbsp;</div>


Again, margins should be specified with css.


see my response above. i'd love to know how to eliminate this if
possible.
<img src='./images/tees/thumbs/t_shitwizard.jpg' class='tee_thumbnail'
alt='you are the shitwizard!'/>


The images should not be resized by the browser, and definitely not by
specifying the desired dimensions in css.


really? i thought i would be doing the user a favour by defining a fixed
aspect ratio in ems so the images would resize with the user's font.
could you explain why it is bad practice?

thanks very much for all the critique - it's been a help. now if only i
could fix that damned right column, i would move on to sorting out the
other bits!
--
slim
Jul 20 '05 #6
slim <sl**@antiCorp.invalid> wrote:
Using XHTML is silly, Transitional is for legacy documents, newly
authored documents should use Strict.
i tried to change this, checked it out in 3 browsers and found a total
mess in ie6 & opera7.1.


Switching to Strict results in standard compliant rendering, it exposes
faults/omissions in your html/css that are masked by Quirk mode
rendering.
Why the div wrapper? H1 is a block level element, styles you have
attached to the wrapper div can be added to the H1.


when i take away the containing div, the header does not accept all the
style attributes i give it and does not display the same. for example, in
firefox, there is a gap between the bottom of header.jpg and the bottom
border. is there some part of <h> tags that overrules styles i apply?


A browser applies default style values for any element, it's up to you
to change them if these result in undesired rendering.
That's a list.


good point. that's kind of done, except i'm still using a div to frame
it, or <ul> won't take the style attributes i need to keep the design the
same.


Again there is no need, <ul> is also a block level element, styles
currently attached to the div can be added to the <ul>.
&nbsp;


Margins should be specified via css.


this was used as part of a fix i found whilst browsing: i want to display
the dotted boxes containing each t-shirt in a row until they need to
break for a new line, this trick was recommended to fix the fact that
they float:left and so occupy no space.

is there a better way to do this? i am currently using a slightly
different version of the same workaround, i'd like to be able to achieve
the boxes displaying as i describe legitimately if possible.


Make a minimized test case and I'll have a look.
Div/span soup.


too many? the contentwrap div was used to fix a bug (which has now
reappeared) where the right column was appearing after the left column
vertically.


Adding spurious markup is not the way to fix problems, tackle it at the
source by learning more about how css works. Ask here if you get stuck,
one problem per post and a minimized test case greatly increases your
chances of someone helping out.
the rightcol div is then defined to house the various parts 10em across
so as to meet the leftcol - is this not necessary then?
At most you need 3 generic block level wrappers (<div>'s) for a site
like this, one for the header/navbar, one for the left col and one for
the content next to the left col. But you've got far more div/span
wrappers than that.
and finally, the divs used to construct the t-shirt dotted boxes were the
only way i could see to achieve the look i wanted without using a table -
would you be able to suggest a better way of achieving that style with
cleaner code?

i'm new(ish) to this and willing to learn, but i'm kind of putting things
together as i pick it up, so it's not always the best approach.
<div class="spacer">&nbsp;</div>


Again, margins should be specified with css.


see my response above. i'd love to know how to eliminate this if
possible.


Redoing an entire page is a lot of work, break it down for us.
The images should not be resized by the browser, and definitely not by
specifying the desired dimensions in css.


really? i thought i would be doing the user a favour by defining a fixed
aspect ratio in ems so the images would resize with the user's font.
could you explain why it is bad practice?


Browsers do a poor job at resizing images
Images don't need to resize with a user's font setting
Images larger than needed take longer to download
Images should remain the same size when a page is viewed sans css

--
Spartanicus
Jul 20 '05 #7
|| name | Spartanicus <me@privacy.net> | message |
|| news:vu********************************@news.spart anicus.utvinternet.i
|| e: ||
Switching to Strict results in standard compliant rendering, it
exposes faults/omissions in your html/css that are masked by Quirk
mode rendering.
i see, thanks. once these problems are fixed, i will switch over and then
fix any problems that entails.
A browser applies default style values for any element, it's up to you
to change them if these result in undesired rendering.
again, i see. i have fixed this, thank you.
Again there is no need, <ul> is also a block level element, styles
currently attached to the div can be added to the <ul>.
and this is fixed too - you're helping a great deal, thanks.
this was used as part of a fix i found whilst browsing: i want to
display the dotted boxes containing each t-shirt in a row until they
need to break for a new line, this trick was recommended to fix the
fact that they float:left and so occupy no space.

is there a better way to do this? i am currently using a slightly
different version of the same workaround, i'd like to be able to
achieve the boxes displaying as i describe legitimately if possible.


Make a minimized test case and I'll have a look.


i have made a page here:

http://awash.demon.co.uk/vd_test.php
http://awash.demon.co.uk/vd_test.css

which contains just the elements needed to display the tee-shirts in the
way i would like them to look. this works the way it is outside of the
main page.

although, as you say, it's not good markup due to the number of block
elements. i suspect this may be the cause of other problems (see below).
Adding spurious markup is not the way to fix problems, tackle it at
the source by learning more about how css works. Ask here if you get
stuck, one problem per post and a minimized test case greatly
increases your chances of someone helping out.
good point. i did ask here and someone suggested that fix as a workaround
for the leftcol div affecting the rightcol div when styles were applied
to it - a problem was arising where the rightcol was placed below the
leftcol. when i first applied that fix it worked.

i have stripped down the page and there are minimised test cases are at:

http://awash.demon.co.uk/vd_coltest_works.php
http://awash.demon.co.uk/vd_coltest_broken.php
http://awash.demon.co.uk/vd_coltest.css

i have highlighted with html comments the part that seems to break the
layout. i think the two main presentation issues i have are related.

it would appear that using the spacer div trick to display the tee-shirt
blocks on the page one after the other, wrapping when necessary, is
breaking the columns. this can be seen working fine without the columns
in the first test case earlier in this reply.

my guess is that a problem with using float:left on the div
"tee_container" and then compensating with the spacer is responsible.
At most you need 3 generic block level wrappers (<div>'s) for a site
like this, one for the header/navbar, one for the left col and one for
the content next to the left col. But you've got far more div/span
wrappers than that.

i have reduced the number of divs in the main page at:

http://awash.demon.co.uk/index.php

to just the left col, the content wrapper and the right col.

unfortunately, more divs are added by containers to house the tee shirt
blocks. perhaps this will be remedied by your reply to the question of
altering that layout - i'm keen to display the t-shirt blocks another way
if it can be done whilst maintaining presentation.
Browsers do a poor job at resizing images
i see, that doesn't surprise me :)
Images don't need to resize with a user's font setting
won't my page be less accessible if someone with bad sight resizes the
font larger and they are still presented with thumbs smaller in size
above it?
Images larger than needed take longer to download
but surely the client would still download the same .jpg from my server
and then resize dynamically?
Images should remain the same size when a page is viewed sans css


ahhhh, the penny snaps ;) is there a better way to tackle the problem of
the thumbs remaining the same dimensions when font size is altered?

thanks again for all your help, the time you've spent and the pointers
you've given me. in future i will endeavour to ask questions here in the
format you have suggested.

cheers
--
slim
Jul 20 '05 #8
slim <sl**@antiCorp.invalid> wrote:
Make a minimized test case and I'll have a look.
i have made a page here:

http://awash.demon.co.uk/vd_test.php


That's simply a section of your page, a minimizes test case has been
stripped down to the bare minimum needed to illustrate a single issue.
The point is to make it easier for others to help you, it's a chore
having to work your way through someone else's code to get to the real
problem. You are very familiar with your code, others aren't.
http://awash.demon.co.uk/vd_test.css


Posting a link to a site's linked stylesheet is helpful when asking for
a site review, for a minimized test case it's a bother. To get to the
issue I now have to juggle a news reader window to read what the problem
is, a window with your css, a window with your markup and a browser
window.

A minimized test case should look like this:
http://www.spartanicus.utvinternet.i...loat_issue.htm

All you have to do to is to open a single browser window, no source view
is needed, the problem is described on the page itself, both the css and
html code is displayed. The html/css code has been stripped of anything
that isn't directly related to the issue.

Indenting your code also helps others to make sense of your code,
especially nested div's are a pain to decipher without indented code.

--
Spartanicus
Jul 20 '05 #9

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

Similar topics

1
by: Xah Lee | last post by:
with strict HTML spec, can one have <p> tags inside table's <td> tag? also, in strict XHTML, can one have <p> tages inside <div>? Thanks. Xah xah@xahlee.org ∑ http://xahlee.org/
9
by: Julia Briggs | last post by:
How do I construct a <iframe> or equivalent for FireFox/NS browsers, inside a screen centered <div> tag? Can it be done?
3
by: Josef K. | last post by:
Asp.net generates the following html when producing RadioButton lists: <td><input id="RadioButtonList_3" type="radio" name="MyRadioButtonList" value="644"...
2
by: Nikolai Onken | last post by:
Hey, I am trying to learn the exact behavior of CSS and was just placing a couple of <div>'s after each other. Each of the <divhas a <pwithin and some text within the <p> Now when I add a...
28
by: Kent Feiler | last post by:
1. Here's some html from a W3C recommendations page. <P>aaaaaaaaa<DIV>bbbbbbbbb</DIV><DIV>cccccccc<P>dddddddd</DIV> 2.Although I didn't think it would make any difference, I tried it with the...
5
by: Agix | last post by:
Hi there, Please check out : http://clarifysolutions.co.uk/certenroll/ The source is included below. This page is a test, so I can play about with paddings, margins and layouts using divs as...
5
by: chakradhari.ashish | last post by:
Does anybody know how can I load an html page inside a <div</div> where the content gets update on the onclick even of anchor <a href=> </a>? I googled around and followed some links pointing me...
10
by: Summercoolness | last post by:
so i am starting to use more of <br /and <div style="clear: both" / which is the XHTML style... now, won't those actually confuse the old browsers? for example, will the old browser treat the...
5
nathj
by: nathj | last post by:
Hi All, I'm working on a new site that has a two column layout underneath a title bar. If you check out: http://www.christianleadership.org.uk/scratch/mainpage.php using IE or Opera you will...
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.