Utilize CSS to display only the text within inner XML tags

Given the following XML code:

<member name="componentName">
    Don't display this text.
    <summary>Display this text.</summary>
</member>

How can I use CSS to show the inner text? I've attempted setting the display of member to none and summary to block, as well as setting the font size of member to zero, but with no success.

Appreciate any help.

Answer №1

Consider the following steps:

user {
  color: transparent;
  font-size:0;
  line-height:0;
}
user description {
  color:#000;
  font-size:16px;
}
<user info="userName">
    Hiding this content.
    <description>Displaying this content.</description>
</user>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Attempting to understand how to effectively implement overflow: hidden

Here is a link to a demonstration showing how the text slides in and out from the left side of the container. I am currently working on resolving this issue. Do you think removing the display:table; property from the #right div would help??? <div clas ...

Trouble arises when attempting to include numerous Visualforce components on a single page

When using a visualforce component multiple times on a page, the hover function does not open any of the dialogs. The problem seems to be related to the ids but I'm unsure about how to resolve it. Below is an example of the code for the visualforce c ...

CSS Display Lag

As someone who is just dipping their toes into the world of coding, I've been experimenting with code in my free time. However, I've encountered an issue with a certain code where the CSS seems to have a noticeable delay. Upon initial loading, th ...

Adjust the size of the input field as text is being typed in

Can a text input box be automatically resized as text is entered? I've been looking online but haven't come across any solutions. ...

Ensure consistency in CSS3 background color transitions

There are multiple elements on the webpage with background transitions that change from one color to another: @-moz-keyframes backgroundTransition /* Firefox */ { 0% {background-color:#ff7b7b;} 33% {background-color:#7fceff;} 66% {backgr ...

Responsive Bootstrap dropdown menu adjusts its size when clicked

I'm currently in the process of creating a basic navbar that includes a drop-down menu on the far right side, as depicted here: https://i.sstatic.net/hs9us.png The issue I'm facing is that when I click on the dropdown, the navbar automatically ...

What measures can be taken to avoid margin collapsing in CSS?

Margin collapse is prevented in this scenario: If an element with clearance has top and bottom margins that are touching, its margins will collapse with the margins of adjacent siblings. However, the resulting margin does not collapse with the parent bl ...

Animating with jQuery Event Sequences

I'm attempting to animate an element first, followed by adding a class once the animation is complete: $(this).animate({ width: "1em" }, 500); $(this).addClass("hidden"); However, the addClass function executes immedi ...

A header with two divs taking up the entire screen

I am trying to create a full-screen header with 2 div elements, similar to the design in this example. So far, I have attempted to implement this layout, but the div elements are not spanning 100% width, and I also need to add an overlay to the right div ...

Adjust Menu Selection Color Based on the HTML Page Being Accessed

I am working on a project where I want to dynamically change the menu color based on the page being loaded. Since this is an HTML project, I cannot use server-side languages for this. Instead, I decided to retrieve the name of the HTML file being loaded an ...

Utilize external cascading style sheets (CSS) to style XML data loaded into Flash

Trying to incorporate formatted xml into a flash game has been quite challenging for me. Despite my efforts, the css styling doesn't seem to be applied properly. Below is the content of my stylesheet woorden.css: .f {color:red;} This is the str ...

"Adding dots" in a slideshow using HTML, CSS, and JS

I'm currently working on a slideshow that includes navigation dots at the bottom. Although the slideshow is functioning properly, I am encountering an issue where only one dot appears instead of the intended three in a row. Despite my research and att ...

Attempting to position the input field beside the label

I need help aligning the input field box next to my label. Currently, there is a gap between the text (label) and the input field when clicking on Item#1 and Invoice Number. I want the input field to be directly next to the label. Can anyone assist me with ...

Creating a Masonry-inspired Design Using Pure CSS

Each box in the image has a unique height, and some boxes are double width. Can a masonry-style layout be achieved using only CSS? ...

What is the best way to use CSS to center two blocks with space in between them?

My goal is to achieve a specific design: I want two text blocks with some space in between them aligned around the midline of the page (refer to the image). I have experimented with the float property, as well as used margin and padding to create the gap ...

What is preventing my element from being positioned absolutely?

Struggling with setting up a CSS3 Menu and having trouble getting my ul to be positioned as absolute. I want the nav element to appear in the top left corner of the screen. Even though I've used the following code, the position properties seem not t ...

``I am experiencing issues with the Ajax Loader Gif not functioning properly in both IE

I am brand new to using ajax and attempting to display a loading gif while my page loads. Interestingly, it works perfectly in Firefox, but I cannot get it to show up in Chrome or IE. I have a feeling that I am missing something simple. The code I am using ...

The HTML autofill pop-up box shifts its position

This autofill function for a text box that I found on is causing some display issues. When typing in a letter, the popup with suggestions shifts the rest of the content below it. How can I resolve this issue? I have attempted to use z-index without succes ...

The surprising outcome of altering the background color of a div during a click event

Currently, I am engrossed in crafting a word guessing game. In this game, I've constructed a visual keyboard. When a user selects a letter on this keyboard, I desire the background color of that specific letter to adjust accordingly - light green if t ...

Enhance the look of your application by customizing the caret color in JavaFX with

I'm looking to customize the caret color for all JavaFX text inputs (such as TextField, TextArea, ComboBox:editable, DatePicker, etc.). I came across a solution on Stackoverflow: How to change the caret color in JavaFX 2.0? There's also an examp ...