Layout-neutral tag for CSS?

前端 未结 8 2050
执笔经年
执笔经年 2021-01-05 05:14

Is there an \"invisible\" tag in HTML (4) that I can use to make CSS distinctions

tag.myclass tag.mysubclass h1 {  } 

without having

8条回答
  •  渐次进展
    2021-01-05 05:58

    The right answer is use a div tag and define a class for it. Here is an example:

    Project 1 - Project 2
    {% if request.user.is_authenticated%} Welcome {{request.user.username}} {% endif %}

    then in your css file you can have a class like this:

    .username {
        color:white; 
        float:right;
        padding-right: 100px;
    }
    

    voila!! It all belongs to h2 tag but the user name has a different css applied.

提交回复
热议问题