Skip to content

Web designing with HTML and CSS - How to add CSS to HTML elements

CSS එහෙම නැත්නම් Cascading Style Sheets use කරන්නේ html tags වලට styles දමන්නත් ඒකෙන් අපිට ඕන විදිහට web pages වල html elements display කරවන්නත් කියලා මේ වෙනකොට ඔයාලා දන්නවා. මේ වැඩේ කරන්න html elements වලට css embed කරන්න වෙනවා.

HTML elements වලට CSS add කරන ආකාර 3ක් තියෙනවා.

1. Inline - html element එකක් ඇතුළේ style attribute එකක් විදිහට

2. Internal - html code එකේ head section එක ඇතුළේ <style> element එකක් විදිහට

3. External - separate external css file එකක් විදිහට

මේ ක්‍රම 3න් වැඩියෙන්ම යොදා ගන්නේ external method එක. මොකද ප්‍රායෝගික ලෝකේ තනි තනි web pages නෑ . Web site එකක නැත්නම් online system එකක pages තමයි වෙන් වෙන් වශයෙන් අපි දකින්නේ. සාමාන්‍යයෙන් web site එකක හැම page එකක්ම common theme එකකට තමයි design කරන්නේ. ඒ වගේ වෙලාවට ඔක්කොම pages වලට පොදු styles තනි css file එකක ලියලා ඒ file එක අනිත් html files වලට link කරන එකයි ඇත්තටම කරන්නේ.

මේ කිව්වේ මොනවද කියලා වැඩිය හිතන්න එපා. ඊළග discussion වෙන වෙනම මේ ක්‍රම 3 ගැන කතා කරමු.

Tagged:
Sign In or Register to comment.