3

I am moving Vue 2 source over to Vue 3 (beta), and came across this:

<template>
  <section id="this">   <!-- how to eliminate this? -->
    <div>
      YOU ARE AT HOME 🏯
    </div>

    <h2>Hi <span>{{ uid }}</span></h2>

    <!-- List the projects we have access to -->
    <div id="grid-container-projects">
      <ProjectTile :project="null" />
      <ProjectTile v-for="p in projectsSorted" :key="p.key" :project="p" />
    </div>
  </section>
</template>

<style scoped>
  #this {
    text-align: center;
  }
  ...

The details don't matter. Applying the text-align: center to the #this node is what I'd like to achieve, but without the #this node.

Is this possible, or reasonable? :)

I tried the following:

<template>   <-- Vue 3 (beta) -->
  <div>
    YOU ARE AT HOME 🏯
  </div>
 ...
</template>

<style scoped>
  * { 
    text-align: center
  }
  ...

This does the wished layout, but causes a stack overflow in the browser. That may of course be just a Vue 3 betaism. (3.0.0-beta.4)

How would you proceed? Leave the section as is, or get rid of it, somehow?

1 Answer 1

1

Personally, I will go with the section because there you add an id in the div tag to uniquely centralize that element.

while in the second option you will generally centralize all the component elements

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.