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

Data Science, Deep Learning, & Machine Learning with Python

Deep Learning, Data Science, & Machine Learning with Python Go hands-on with the latest neural network, artificial intelligence,deep learning and data science techniques employers are seeking! What Will I Learn? Develop using iPython notebooks Understand statistical measures such as standard deviation Visualize data distributions, probability mass functions, and probability density functions Visualize data with matplotlib Use covariance and correlation metrics Apply conditional probability for finding correlated features Use Bayes' Theorem to identify false positives Make predictions using linear regression, polynomial regression, and multivariate regression Understand complex multi-level models Use train/test and K-Fold cross validation to choose the right model Build a spam classifier using Naive Bayes Use decision trees to predict hiring decisions Cluster data using K-Means clustering and Support Vector Machines (SVM) Build a movie r...

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 ...

Bootstrap 4 From Scratch With 5 Projects

Bootstrap 4 From Scratch With 5 Projects Master the latest version of Bootstrap (4.0.0 Beta) and build 5 real world themes while learning HTML5 semantics & CSS3 What Will I Learn? Learn and create amazing high quality Bootstrap 4 themes and UIs from scratch Learn the Bootstrap 4 utilities, classes, components & JS widgets using a custom sandbox environment Create a professional workflow & dev server to build from source and compile Sass Requirements You should have basic knowledge of HTML & CSS You do NOT need to know any Bootstrap 3 Description This course will literally take you from knowing nothing about Bootstrap 3 or 4 to learning all of the utilities, components, widgets and grids and building real world themes and websites. You do NOT need to know Bootstrap 3 for this course. Even if you already know Bootstrap 4, skip the learning sections and head right for section 6 to create the custom workflow and start the projec...