0
on the site I’m trying to develop,
In the middle there’s a section of frequent questions and I have the following structure:
$( 'body div#duvidas > section.duvidas > article' ).click( function () {
$( 'body div#duvidas > section.duvidas > article' ).not( this ).find( "header" ).removeClass( "ativo" );
$( 'body div#duvidas > section.duvidas > article' ).find( "p" ).hide();
$( this ).find( 'header' ).removeClass( 'ativo' ).toggleClass( 'ativo' );
if ( !$( this ).find( 'p' ).is( ':visible' ) ) {
$( this ).find( 'header' ).addClass( 'ativo' );
$( this ).find( 'p' ).slideToggle( "slow" );
} else {
$( this ).find( 'header' ).removeClass( 'ativo' );
$( this ).find( 'p' ).slideToggle( "slow" );
}
}
)
body div#duvidas > section.duvidas {
flex-direction: column;
width: 60%;
}
body div#duvidas > section.duvidas > article {
border-width: 1px 1px 0 1px;
border-color: #1b3665;
border-style: solid;
}
body div#duvidas > section.duvidas > article > header:hover,
body div#duvidas > section.duvidas > article > header:active{
color: #fff;
background-color: #1b3665;
}
body div#duvidas > section.duvidas > article:last-of-type {
border-bottom: 1px solid #1b3665;
}
body div#duvidas > section.duvidas > article > p {
display: none;
padding: 10px;
}
body div#duvidas > section.duvidas > article > header {
position: relative;
color: #1b3665;
font-size: 1.5em;
font-weight: bolder;
cursor: pointer;
padding: 10px 35px 10px 10px;
}
body div#duvidas > section.duvidas > article > header::after {
position: absolute;
display: inline-block;
right: 5px;
top: 0;
content: '+';
width: 30px;
height: 30px;
line-height: 30px;
text-align: center;
bottom: 0;
margin: auto 0;
}
body div#duvidas > section.duvidas > article > header::after {
content: '+';
}
body div#duvidas > section.duvidas > article > header.ativo {
color: green;
}
body div#duvidas > section.duvidas > article > header.ativo::after {
content: '-';
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<body>
<div id=duvidas>
<section class=duvidas>
<article>
<header>Este Título é grande de mais para caber nesse header você não acha?</header>
<p>Texto</p>
</article>
</section>
</div>
</body>
In the header, I have a ::after
But I’m with a problem I can’t seem to solve:
The text of titles, when in mobile version, end rising about the contents of ::after
Again lack of attention my right?
– Carlos Rocha
@Carlosrocha as I have told you a few times... you are sinning with basic things... You have to know the difference between padding and margin, know when to use one or the other etc. You find on youtube a plethora of Portuguese lessons about this, take advantage and see also some lessons about position and display. you will not spend 2 hours on this and will learn for the rest of your life. It is the tip
– hugocsl
My case is more serious: Knowing I know. But it’s missing is attention even! As I work alone, do everything, back, data and front. Sometimes I end up getting a little caught up (?) and getting lost!
– Carlos Rocha
@Carlosrocha vdd sometimes gives a white of basic things and we end up taking the hard way when in reality it is easier than we imagine
– hugocsl