HTML Style

    1100421 VIEW 1 0

Using inline CSS for HTML styles is the best option when you need to change the look of a single element. Inline means declaring the style inside the tag which defines the element to be styled such as color, font, size, and more.

All you need to use is the HTML style attribute:

<tag style="name:value"> content </tag>

As you can see, you need to define the CSS styling property in a name-value pair. Let's look at a few examples of the most commonly used properties in HTML styles.

The color property defines the color of text for the element. The color can be written in either its name, RGB or HEX value:

<p style="color: rgb(255, 0, 255);">I am a unicorn</p>
<p style="color: #42f4ee;">I am a star</p>
<p style="color: lime;">I am a lime</p>

The background-color property changes the HTML background  color in your document. It accepts the same values as the color property: so as you can use height  to show the height of pragraph  and width for  show width of pragraph

<p style="background-color: black; height: 200px; width: 200px;"></p>
<p style="background-color: rgb(255, 0, 255); height: 200px; width: 200px;"></p>
<p style="background-color: #333666; height: 200px; width: 200px;"></p>

Text Properties

Property Description Values
color Sets the color of a text RGB, hex, keyword
line-height Sets the distance between lines normal, number, length, %
letter-spacing Increase or decrease the space between characters normal, length
text-align Aligns the text in an element left, right, center, justify
text-decoration Adds decoration to text none, underline, overline, line-through
text-indent Indents the first line of text in an element length, %
text-transform Controls the letters in an element none, capitalize, uppercase, lowercase

List Properties

Property Description Values
list-style Sets all the properties for a list in one declaration list-style-type, list-style-position, list-style-image, inherit
list-style-image Specifies an image as the list-item marker URL, none, inherit
list-style-position Specifies where to place the list-item marker inside, outside, inherit
list-style-type Specifies the type of list-item marker none, disc, circle, square, decimal, decimal-leading-zero,
armenian, georgian, lower-alpha, upper-alpha, lower-greek,
lower-latin, upper-latin, lower-roman, upper-roman, inherit

 


Border Properties

Property Description Values
border Sets all the border properties in one declaration border-width, border-style, border-color
border-bottom Sets all the bottom border properties in one declaration border-bottom-width, border-bottom-style, border-bottom-color
border-bottom-color Sets the color of the bottom border border-color
border-bottom-style Sets the style of the bottom border border-style
border-bottom-width Sets the width of the bottom border border-width
border-color Sets the color of the four borders color_name, hex_number, rgb_number, transparent, inherit
border-left Sets all the left border properties in one declaration border-left-width, border-left-style, border-left-color
border-left-color Sets the color of the left border border-color
border-left-style Sets the style of the left border border-style
border-left-width Sets the width of the left border border-width
border-right Sets all the right border properties in one declaration border-right-width, border-right-style, border-right-color
border-right-color Sets the color of the right border border-color
border-right-style Sets the style of the right border border-style
border-right-width Sets the width of the right border border-width
border-style Sets the style of the four borders none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset, inherit
border-top Sets all the top border properties in one declaration border-top-width, border-top-style, border-top-color
border-top-color Sets the color of the top border border-color
border-top-style Sets the style of the top border border-style
border-top-width Sets the width of the top border border-width
border-width Sets the width of the four borders thin, medium, thick, length, inherit

Font Properties

Property Description Values
font Sets all the font properties in one declaration font-style, font-variant, font-weight, font-size/line-height, font-family, caption, icon, menu, message-box, small-caption, status-bar, inherit
font-family Specifies the font family for text family-name, generic-family, inherit
font-size Specifies the font size of text xx-small, x-small, small, medium, large, x-large, xx-large, smaller, larger, length, %, inherit
font-style Specifies the font style for text normal, italic, oblique, inherit
font-variant Specifies whether or not a text should be displayed in a small-caps font normal, small-caps, inherit
font-weight Specifies the weight of a font normal, bold, bolder, lighter,
100, 200, 300, 400, 500, 600, 700, 800, 900, inherit
Careful, many of these are not supported!