Sublime Text
<!DOCTYPE html> <html> <head> <style type="text/css"> body{ background-position: 50% 50%; } div{ margin:30px; width:400px; height:300px; background-color:pink; background-image: url(../image/smile-face.png); background-repeat: no-repeat; background-position: inherit; } </style> </head> <body> <div></div> <p>- <i><u>GIẢI THÍCH</u>:</i> Thuộc tính background-position của phần tử div sẽ kế thừa giá trị thuộc tính background-position từ phần tử cha của nó <i>(tức là 50% 50%)</i></p> </body> </html>
<!DOCTYPE html> <html> <head> <style type="text/css"> body{ background-position: 50% 50%; } div{ margin:30px; width:400px; height:300px; background-color:pink; background-image: url(../image/smile-face.png); background-repeat: no-repeat; background-position: inherit; } </style> </head> <body> <div></div> <p>- <i><u>GIẢI THÍCH</u>:</i> Thuộc tính background-position của phần tử div sẽ kế thừa giá trị thuộc tính background-position từ phần tử cha của nó <i>(tức là 50% 50%)</i></p> </body> </html>