/    Sign up×
Community /Pin to ProfileBookmark

I’ve been trying to fix any errors on my page, and I tried replacing the deprecated center tag with

[CODE]<div style=”text-align:center”>[/CODE]

But this throws everything off on the page.

Here’s the page using center:

[URL=http://charlesnewmanpubl.com/catalog.html]http://charlesnewmanpubl.com/catalog.html[/URL]

and here’s using div

[URL=http://charlesnewmanpubl.com/catalog_test.html]http://charlesnewmanpubl.com/catalog_test.html[/URL]

Is there some other way to do this?

to post a comment
HTML

6 Comments(s)

Copy linkTweet thisAlerts:
@DaiLaughingJul 24.2009 — As a side issue sounds which play without the user asking for them are considered unwise. Given how high my speakers were set and the time of morning I'm surprised my heart is still beating.

If you change the background-color: of the div you should find that the content inside the div is centred as you wanted. The problem is that the div is not centred on the page.

To centre it I believe that the correct way is to set left and right margins to auto. Not being a CSS guru I have always done a trick with margins and widths instead but try the right way first.
Copy linkTweet thisAlerts:
@rlinsurfauthorJul 24.2009 — np. I actually did almost exactly that. But I'm now getting errors because of that.

[code=html]<table style:auto; cellpadding="0" cellspacing="0" border="0" width="760" bgcolor="#700104">[/code]

[code=html]Line 31, Column 18: "STYLE:AUTO" is not a member of a group specified for any attribute
<table style:auto; cellpadding="0" cellspacing="0" border="0" width="760" bgcolo
&#9993;
Line 31, Column 18: character ";" not allowed in attribute specification list
<table style:auto; cellpadding="0" cellspacing="0" border="0" width="760" bgcolo
&#9993;
Line 31, Column 20: character data is not allowed here
<table style:auto; cellpadding="0" cellspacing="0" border="0" width="760" bgcolo[/code]


Also, you may have misread something on the page. The audio only plays if there's an onclick event.

I hate those kind of websites ?
Copy linkTweet thisAlerts:
@DaiLaughingJul 24.2009 — The style attribute is structured like this:

style="width:100px; left:50px;"

that's where the errors are coming from. Having said that tables for layout is just as deprecated as the center tag. You need to use DIVs. Your pages have switched around or something but if you have a DIv for each main page element they will appear under each other. You could then set the width of the DIVs to the widest page element. Then centre them like this:

&lt;div style="position:relative; width:600px; left:50%; margin:0px; padding:0px; margin-left:-300px; text-align:center&gt;content here&lt;/div&gt;

You can change the width as long as you change the margin to exactly half as well. However, it looks like this might be the right/correct way to do the same thing but I have not tested it properly myself:

[CODE]<div style="width:600px; margin-left:auto; margin-right:auto; text-align:center;">content here</div>[/CODE]

You should be looking to use embedded or external styles really but for learning this will do.
Copy linkTweet thisAlerts:
@peachskittleJul 24.2009 — Use margin auto, but make sure you have a width set. It will work. (I know this was stated before, but I'm confirming this with everything behaving normally, a box with a set width and margin left and right of "auto" will place the div in the center and should be used instead of the negative margin.
Copy linkTweet thisAlerts:
@DaiLaughingJul 24.2009 — Thanks for that peach. I sort of know it makes sense but don't yet fully trust it!
Copy linkTweet thisAlerts:
@rlinsurfauthorJul 25.2009 — I just tried this, and it seems to work:

[code=html]<table style="margin:0 auto; background:#700104;" cellpadding="0" cellspacing="0" border="0" width="760" >[/code]
×

Success!

Help @rlinsurf spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...