If I write <hr width="50%" align="1% right" /> then output line comes in the center,though it is supposed to be at right side? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

If I write <hr width="50%" align="1% right" /> then output line comes in the center,though it is supposed to be at right side?

Can anyone tell why it is happening this way? ?

20th Mar 2017, 4:34 PM
Safreena
Safreena - avatar
5 Answers
+ 10
Don't use html attributes to style your elements, most of them are deprecated with Html5, but Css instead ^^
20th Mar 2017, 6:48 PM
visph
visph - avatar
+ 8
Anyway, with old syntax of align attribute, this will work with: <hr width="50%" align="right"> ... as it's not valid to set align="1% right" ^^ Whatever, you can do it with 'margin' values Css property ( as suggested by @Yaroslav Pieskov ): hr { width:50%; margin-left:auto; margin-right:1%; }
20th Mar 2017, 6:57 PM
visph
visph - avatar
+ 2
it's a block element with margin-left and margin-right = auto. try to turn off auto margin before
20th Mar 2017, 4:45 PM
Yaroslav Pieskov
Yaroslav Pieskov - avatar
0
It looks like a forward message 😕
21st Mar 2017, 5:55 PM
Safreena
Safreena - avatar
0
don't add 1%. just align="right"
23rd Mar 2017, 4:29 PM
Isaac Koranteng
Isaac Koranteng - avatar