Question

Website programming Do some research on the values of the vertical-align property. Why do you think...

Website programming

Do some research on the values of the vertical-align property. Why do you think it is so important to have such control over the way text is displayed.


Search entries or authorFilter replies by unreadUnread     Collapse replies Expand replies
Subscribe
0 0
Add a comment Improve this question Transcribed image text
Answer #1

The vertical-align CSS property sets vertical alignment of an inline or table-cell box.

Syntax

/* Keyword values */
vertical-align: baseline;
vertical-align: sub;
vertical-align: super;
vertical-align: text-top;
vertical-align: text-bottom;
vertical-align: middle;
vertical-align: top;
vertical-align: bottom;

/* <length> values */
vertical-align: 10em;
vertical-align: 4px;

/* <percentage> values */
vertical-align: 20%;

/* Global values */
vertical-align: inherit;
vertical-align: initial;
vertical-align: unset;

Values for inline elements

Parent-relative values

These values vertically align the element relative to its parent element:

baseline

Aligns the baseline of the element with the baseline of its parent. The baseline of some replaced elements, like <textarea>, is not specified by the HTML specification, meaning that their behavior with this keyword may vary between browsers.

sub

Aligns the baseline of the element with the subscript-baseline of its parent.

super

Aligns the baseline of the element with the superscript-baseline of its parent.

text-top

Aligns the top of the element with the top of the parent element's font.

text-bottom

Aligns the bottom of the element with the bottom of the parent element's font.

middle

Aligns the middle of the element with the baseline plus half the x-height of the parent.

<length>

Aligns the baseline of the element to the given length above the baseline of its parent. A negative value is allowed.

<percentage>

Aligns the baseline of the element to the given percentage above the baseline of its parent, with the value being a percentage of the line-height property. A negative value is allowed.

Line-relative values

The following values vertically align the element relative to the entire line:

top

Aligns the top of the element and its descendants with the top of the entire line.

bottom

Aligns the bottom of the element and its descendants with the bottom of the entire line.

For elements that do not have a baseline, the bottom margin edge is used instead.

Values for table cells

baseline (and sub, super, text-top, text-bottom, <length>, and <percentage>)

Aligns the baseline of the cell with the baseline of all other cells in the row that are baseline-aligned.

top

Aligns the top padding edge of the cell with the top of the row.

middle

Centers the padding box of the cell within the row.

bottom

Aligns the bottom padding edge of the cell with the bottom of the row.

Negative values are allowed.

Formal syntax

baseline | sub | super | text-top | text-bottom | middle | top | bottom | <percentage> | <length>

Example

HTML

<div>An <img src="https://mdn.mozillademos.org/files/12245/frame_image.svg"  width="32" height="32" /> image with a default alignment.</div>
<div>An <img class="top" src="https://mdn.mozillademos.org/files/12245/frame_image.svg"  width="32" height="32" /> image with a text-top alignment.</div>
<div>An <img class="bottom" src="https://mdn.mozillademos.org/files/12245/frame_image.svg"  width="32" height="32" /> image with a text-bottom alignment.</div>
<div>An <img class="middle" src="https://mdn.mozillademos.org/files/12245/frame_image.svg"  width="32" height="32" /> image with a middle alignment.</div>

CSS

img.top { vertical-align: text-top; }
img.bottom { vertical-align: text-bottom; }
img.middle { vertical-align: middle; }

Output

The vertical-align property is specified as one of the values listed below.

The vertical-align property can be used in two contexts:

  • To vertically align an inline element's box inside its containing line box. For example, it could be used to vertically position an <img> in a line of text:

  • To vertically align the content of a cell in a table:

​​​​​​​

Add a comment
Know the answer?
Add Answer to:
Website programming Do some research on the values of the vertical-align property. Why do you think...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Do you think celebrities or politicians influence how individuals perceive the cause of feminism? Why or...

    Do you think celebrities or politicians influence how individuals perceive the cause of feminism? Why or why not? Based on the information you have read in this text, do you think feminist is still necessary? Why or why not? Also, research one famous feminist and present some details about their work.

  • Why do you think audit reports are important? What are some of the most important factors...

    Why do you think audit reports are important? What are some of the most important factors or skills for auditors? Have you heard about Forensic Accounting? 

  • Why do you think some people fear public speaking? What are some methods to eliminate speaker...

    Why do you think some people fear public speaking? What are some methods to eliminate speaker apprehension? Do you have this fear? If so, why? If not, what do you do to prevent it? What are some tips found in chapter 14 that can help a nervous speaker overcome anxiety?

  • 1. Why should programmers think differently? (1.5 pts) 2. How do you think a programming language...

    1. Why should programmers think differently? (1.5 pts) 2. How do you think a programming language does or should affect the way we think about solving problems? (1.5 pts) 3. Pick another student's discussion post/thread and respond with a constructive comment such as to why you agree, disagree, or have additional information. (For example, the first student states that variables are interchangeable and should be terse (e.g. x) in Python but you respond that terse variable names can be problematic...

  • plz try to give all the answers. In the reducing sugar exercise, why do you think...

    plz try to give all the answers. In the reducing sugar exercise, why do you think the time that the samples are in the hot water bath not exceed two minutes? In the starch exercise, why must you shake the positive control and each of the unknowns before taking a sample of each? 2. 3. What structure, within proteins, does the biuret reagent actually react with when it gets reduced giving positive result? 4. Now that you have completed all...

  • in what do you think your life would be different with such accurate recall of your...

    in what do you think your life would be different with such accurate recall of your autobiographical memory? Overview: Section 24.1 of your text contains a brief description of Jill Price, a woman who possessed a "super memory". Price was able to recall, with startling clarity, every day of her life since the age of 14. Imagine what it would be like to also have such an exceptional memory. Instructions: • In what way do you think your life would...

  • What you will be doing summarizing the content of the chapter and practicing your research skills....

    What you will be doing summarizing the content of the chapter and practicing your research skills. You will be doing that by creating a (mock) annotated bibliography for the content from Chapters 10. An annotated bibliography is just like a regular bibliography for a traditional paper, a list of sources, but for each source you have to include a paragraph explaining what the source is about (a summary). They are typically used in preparation of a paper, you will however be using these...

  • Have you ever considered how we come to understand the world around us? Think about that question for a minute. What is...

    Have you ever considered how we come to understand the world around us? Think about that question for a minute. What is science, and how do we use it to solve real-world problems? In our first discussion, I want to delve into thinking about the nature of biology. This includes what it is, the major themes, and how we come to form claims or knowledge. You should spend approximately 3 hours on this assignment. Instructions Use the text readings and...

  • (2) When we discuss body composition results with an individual, why do you think that we...

    (2) When we discuss body composition results with an individual, why do you think that we as health professionals should carefully choose our words and try to soften what otherwise may be a harsh reality of poor results? Keep in mind, that even though we will be particular with what we say, that doesn't mean we don't report results or just simply glaze over them to make the individual feel better. (3) Body composition is a very broad term as...

  • Discuss your response to these questions. Do you think the Internet should be regulated? If so...

    Discuss your response to these questions. Do you think the Internet should be regulated? If so why and by whom? What aspect of the Internet should be regulated? What are the implications of regulating / not regulating? For the first time, organizations can apply for an Internet address all their own, marking the start of a new era in the growth of the Internet. For example, .com and .org could be replaced by .starbucks or .newyork. The expansion was planned...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT