/    Sign up×
Community /Pin to ProfileBookmark

Discuss: what can you do in the case?

I find <form> has a property called ‘id’, i.e. ‘product’. ?

If the <form> also has an ID in css, i.e.

[CODE]#myform {
….
}[/CODE]

The <form> will be:

[CODE]<form id=”product” id=”myform” ….
</form>[/CODE]

I guess code above doesn’t work (never test).

What can you do in the case?

Is it only solution to change [B]ID #myform[/B] to [B]class .myform[/B]?
What else you can do?

I believe this is important reason that people prefer class in css, do you think so?

.

to post a comment
CSS

4 Comments(s)

Copy linkTweet thisAlerts:
@rtretheweyMay 10.2012 — There's nothing wrong with the CSS and HTML code you posted. The stylesheet should control the appearance of the form #myform. If it doesn't, the problem lies elsewhere. Post the code or the URL of the page so someone can look at it and help you.
Copy linkTweet thisAlerts:
@CharlesMay 10.2012 — There is something very much wrong with the HTML. As you observed, elements can only have one ID attribute and ID attributes need to be unique on a page. But you can run classes together and use them multiple times on a page. SO you could use &lt;form action="Some_Script.php" id="product" class="myform"&gt; or even &lt;form action="Some_Script.php" class="product myform"&gt;
Copy linkTweet thisAlerts:
@spufiMay 11.2012 — It's bad naming if you come away with two IDs. I would simply call it product or product_form.
Copy linkTweet thisAlerts:
@KorMay 11.2012 — Or:
<i>
</i>#myform, #product {
....
}
...
&lt;form id="product"&gt;

An HTML element can not have the same attribute twice (or more), thus it can not bear two [B]id[/B] tokens.
×

Success!

Help @html20009876 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.18,
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,
)...