Skip to main content

5 - HTML Styles

HTML Style Attribute


To make the content beautiful and appealing we would need to apply some styling. Styling can be applied also via CSS which we'll learn in the CSS lessons. However, what we learn here under the style attribute can be applied later on for the CSS.

The style attribute is used as any other attribute to the HTML elements.
<tag style ='property:value;> Content </tag>

The style could have a property such as color and a value or what color.

HTML style attribute exercises background-color:value;


<h1 style="background-color:green; "> Forth pre-defined content</h1>
<hr>
<pre style="background-color:red;">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin
pharetra urna nec porta porttitor. Integer lobortis mattis iaculis. Suspendisse nec fringilla ex. Curabitur urna erat,
ullamcorper non nisl ac, varius egestas tortor. Donec in orci

sapien. Proin interdum libero risus, nec ornare eros mattis nec. Quisque sed tristique est, nec molestie diam.
Fusce in velit vel turpis faucibus accumsan nec non neque. Curabitur ac consequat diam. Donec et mauris quis est
lobortis feugiat

quis nec leo. Integer vulputate, mauris molestie lobortis posuere, augue nunc vestibulum mauris, nec
vehicula quam enim nec mi. Pellentesque pretium volutpat dolor nec tempus. Proin imperdiet velit ut nisl egestas
egestas. Fusce at lorem efficitur,

eleifend diam et, maximus libero. Interdum et malesuada fames ac ante ipsum primis in faucibus.</pre>

HTML StylesHTML Styles

 

HTML Styles

 

HTML Style

The change is visible already. You can use any colors to play around in your concept

We can also change the font of the text too by simply adding another property to the style attribute. Let's make the font to Ariel for the heading and Verdana for the <pre> element.

HTML StyleHTML Style

 

HTML Style

 

We can also change the font size of the text by simply adding another property to the style attribute. Let's make the font size for the heading to 300% increase and for the <pre> element 200%

HTML style font-size:300%; attribute;exercise


HTML Style

 

HTML Style

 

We can notice the change at this point. The font of the heading increased and the font for the <pre> element also increased.

We can also align the text by simply adding another property to the style attribute. Let's make the alignment to the center.

HTML Style

 

HTML Style

We can notice the change at this point. The text was aligned or was centered.

At this point, I truly hope that you see where this is all going and what we can do by simply learning the specifics of the HTML markup language. We can really build nice web pages. The style attribute can be applied to any HTML element. This way we can change the appearance of the web page.

Examples


body, div section, heading, paragraph etc We learned about the following style attributes background-color color font-family font-size text-align

 

Comments

Popular posts from this blog

GraphQL with React: The Complete Developers Guide

GraphQL with React: The Complete GraphQL Developers Guide Learn and master GraphQL by building real web apps with React and Node What Will I Learn? Build amazing single page applications with React JS and GraphQL Master fundamental concepts behind structuring GraphQL servers Realize the power of building flexible data schemas Be the engineer who explains how GraphQL works to everyone else, because you know the fundamentals so well Become fluent in the ecosystem supporting GraphQL, including the differences between Apollo and Relay Requirements Familiarity with React Description Note: This course assumes you are familiar with React ! If you're tired of spinning your wheels trying to figure out what type of backend server to use, this is the course for you. Authentication?  You will learn it.   Apollo Data?  Included.   Integration with React?  Of course! This GraphQL Developers Guide will get you up and running with Grap...

Oracle DBA 11g/12c - Database Administration for Junior DBA

Oracle DBA 11g/12c - Database Administration for Junior DBA Learn to become an Oracle Database Administrator (DBA) in 6 weeks and get a well paid job as a Junior DBA What Will I Learn? Final Goal: Get a job as an Oracle Database Administrator (Oracle DBA) As a Oracle Database Administrator (Oracle DBA), you would be able understand the Database Architecture, which will help you to perform your DBA duties with better understanding. As a Oracle Database Administrator (Oracle DBA), you would be able to Install the necessary Oracle Software/Database As a Oracle Database Administrator (Oracle DBA), you would be able to Administer User accounts in the Database As a Oracle Database Administrator (Oracle DBA), you would be able to Manage Tablespace's to provide required space for the data As a Oracle Database Administrator (Oracle DBA), you would be able perform Backup and Recovery as needed. As a Oracle Database Administrator (Oracle DBA), you would be able to diagnose ...

Docker Mastery: The Complete Toolset From a Docker Captain

Docker v17.09 Latest! Build, compose, deploy, and manage Docker containers from development to DevOps based Swarm clusters What Will I Learn? How to use Docker and Compose on your machine for better software building and testing. Build a fancy multi-node Swarm cluster for production deployments! Skills to build advanced development environments with your code running in containers. Update and change your Swarm Services without downtime using rolling updates. Hand's-on with best practices for making files and Compose files like a Pro! Experience using multi-host logging and event monitoring for Docker Swarm. Build and publish your own custom images. Understand the new Windows Containers, and try your hand at ARM Containers. Requirements No paid software required - Just install your favorite text editor and browser! Local admin access to install Docker for Mac/Windows/Linux. Understand terminal or command prompt basics. Li...