BY (Attribution), which is a required part of every CC license except PDM/CC0, says:
You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
So you have to give attribution in the way the author requires it. See for example the guidelines from Stack Exchange and Wikipedia.
However, the author may not require simply anything (making it nearly impossible to reuse the content), but only: which name (not) to cite, and/or which URL (not) to cite.
If the author says that a HTML comment containing the original URL suffices, you could use a HTML comment, of course. You could say that the author gives you a "special" license here, which doesn’t necessarily have to be compatible to the CC license. If the author licenses something under a CC license and says that you are required to give attribution in a HTML comment, you could simply ignore that, reuse the content (under CC terms) and give attribution on the page.
IANAL, but I’d say you should give attribution in the same "place" where you use the content. E.g. if you reuse some CC licensed content on a HTML page, you should give attributon on that HTML page. And if you reuse content in HTML comments, you should give the attribution in HTML comments. And if you create a video with CC licensed material, include the attribution in the video. In the case of embedding an image (or video etc.) on a page, you should give attribution on that page. You’ll often see people giving attribution in the footer of page (and not directly near the content they reused), or people giving attribution on a separate page. Some probably only give in the metadata of a format. But I did not check the license text if this would be allowed.
What if the author didn’t specify any way?
Have a look at best practices in the CC wiki:
If the copyright holder has not specified any particular way to attribute them, this does not mean that you do not have to give attribution. It simply means that you will have to give attribution to the best of your ability with the information you do have.
They list five things, in short:
- leave other copyright notices intact (resp. reproduce them)
- cite the author’s (nick) name, possibly with a link to a profile page
- cite the work’s title, possibly with a link to the original work
- cite and link to the specific CC license
- if you make a derivative work / adaption, communicate that