+ 3
Which tag is used to align image to center
Please help me
10 Answers
+ 7
Cbrâ[exams] LOL... I like your quote:
"Well let's enjoy the moment since the center tag is still supported..." đđ€Ł
For those interested in why legacy tags like <center>, <b>, <font>, <i>, <u>, and others are slated to be deprecated, it's because these tags are meant to describe formatting, which is a presentation concern.
One of the objectives of HTML5 was to implement a separation of concerns between content and design. This allows for the HTML to focus on content as data, such that changes to design should not require changes to document elements.
Therefore, if an element needed to be changed from a center layout to right aligned, the change would only require an update to CSS.
The reason these are still supported today is to give existing websites ample time to remove these tags before browsers drop support for them altogether.
Therefore, it might not be a good idea to use these tags on anything in a production release of a website.
I hope this explanation is helpful.
+ 6
Ayush Sinha I would also add that the align attribute in an HTML element is deprecated with HTML5.
+ 5
Plz check this..đđđđ
https://www.sololearn.com/discuss/1820307/?ref=app
+ 5
Cbrâ[exams] Your CSS alternative using absolute positioning is good if the image doesn't need to be relative to other elements.
Once absolute positioning is introduced, the approach to styling those elements are applied to a completely separate context than those using relative positioning. Coordinating the alignment between multiple contexts can get a bit tricky as the page gets more complex.
I try to avoid absolute positioning to spare myself the many painful hours that typically follows when attempting to apply the simplest change causing a ripple effect of problems. đ
I recommend keeping relative positioning by setting the left and right margins to auto. The element should also be set to block, if it's inline.
Ex:
img {
 display: block;
margin-left: auto;
margin-right: auto;
}
+ 1
https://www.sololearn.com/discuss/1837183/?ref=app
+ 1
David Carroll most informational as always. Thank you for laying out those details.
0
Cbrâ[exams] center was a tag , its not a w3c recommendation.
however many browsers support this tag, Chrome is one of them
it could be removed any time from browser support