Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> CSS

Thay đổi giá trị Display mặc định với CSS


Mọi phần tử trong CSS đều có giá trị display mặc định và chúng ta có thể dễ dàng thay đổi bằng cách đặt rõ ràng giá trị display. Ví dụ dưới đây đặt display: inline cho menu ngang:

Ví dụ

<!DOCTYPE html> <html> <head> <style> p {    background-color: orange;    color: white; } li {    display: inline; } </style> </head> <body> <h2>Tutorials List</h2> <p>Following are the list of resources:</p> <ul> <li><a href="https://www.tutorialspoint.com/machine_learning/index.htm" target="_blank">Machine Learning</a></li> <li><a href="https://www.tutorialspoint.com/python_data_science/index.htm" target="_blank">Python Data Science</a></li> <li><a href="https://www.tutorialspoint.com/python/index.htm" target="_blank">Python</a></li> <li><a href="https://www.tutorialspoint.com/csharp/index.htm">C#</a></li> <li><a href="https://www.tutorialspoint.com/artificial_intelligence/index.htm" target="_blank">Artificial Intelligence</a></li> </ul> </body> </html>

Kết quả

Thay đổi giá trị Display mặc định với CSS