Solved

position span inside a table cell by class or id

Posted on 2016-10-20
5
67 Views
Last Modified: 2016-10-21
If i have a html table with id of mytable and inside of this table i have a table cell with class colstyle 2. In this table cell I have 2 spans.
One span has a class of span1class and the other one has a class of span2class

If I use this css statement it positions both of my spans on the top right

        #mytable td.colstyle2 span {
            position: absolute;
            top: 1px;
            right: 1px;
        }

How would my statement look if I only want the statement to apply to the span with class span1class ?
0
Comment
Question by:maqskywalker
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 2

Expert Comment

by:Amita Singh
ID: 41853289
please share your html code or link.
0
 
LVL 1

Author Comment

by:maqskywalker
ID: 41853930
Hi here is a fiddle of my example.

http://jsfiddle.net/r2db13tg/

Notice how the span containing "Howdy"  and the span containing "Hello" are both being put on the top right.

I only want the span with class Peach containing "Hello"  to be put on the top right.

My desired result should look like this:

desired result
So in my fiddle. This span with and it's hyperlink are the only thing I want put on the top right corner:

                                    <a href="http://www.google.com">
                                        <span title="My Second Span" class="PeachClass" id="TestSpan2">
                                            Hello
                                        </span>
                                    </a>
0
 
LVL 2

Accepted Solution

by:
Amita Singh earned 500 total points
ID: 41854242
add this css
#mytable td.colstyle2 span#TestSpan2 {
    position: absolute;
    right: 1px;
    top: 1px;
}

Open in new window

0
 
LVL 1

Author Closing Comment

by:maqskywalker
ID: 41854363
Perfect. Thanks.
0
 
LVL 2

Expert Comment

by:Amita Singh
ID: 41854372
You Welcome
0

Featured Post

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question