Webdesign – die besten Beiträge

2 DIV mit CSS responsiv nebeneinander platzieren?

Hallo allerseits, ich versuche gerade seit zwei Tagen verzweifelt den gleichen Look zu kriegen wie der FAQ-Bereich auf folgender Seite ganz unten: https://rlax.me/

Das heißt ich möchte auf beiden Seiten mehrere Slide-Elemente haben, die unabhängig voneinander auf und zu gehen. Auf kleineren Displays soll es dann zusammengerückt werden, sodass der rechte Bereich dann unter dem unteren angezeigt wird. Aber irgendwie bekomme ich es einfach nicht hin. Ich hoffe Ihr könntet mir vielleicht etwas auf die Sprünge helfen. Hier mein Code aktuell:

<html>
<head>
<style>
	
	#left { display:block; }
	#right { display:block; }
  
  .slides {padding:0px; margin:0px auto;} 
  
  .show {display:grid; grid-template-rows:0; overflow:hidden; transition:0.75s; width:100%; margin:5px 0;}
  .show-start {min-height:0;}
  .show-end {min-height:0; align-self:end;}
  .show p {margin:0; padding:0; text-align:justify; color:#121212;}
  details.more[open] + div {grid-template-rows:10fr; padding-bottom:10px; outline:0;} 
  details summary {cursor:pointer; -webkit-tap-highlight-color:#000000; color:#121212; background-color:lightgrey; padding:10px}
  details summary:focus {outline:none !important;}
</style>
</head>




<body>
<div class="slides" id="left">
	<details class="more"><summary>The Night Café</summary></details>
	<div class="show">
		<div class="show-start">
			<p>The Night Café (French: Le Café de nuit) is an oil painting created by Dutch artist Vincent van Gogh in September 1888 in Arles.[1] Its title is inscribed lower right beneath the signature. The painting is owned by Yale University and is currently held at the Yale University Art Gallery in New Haven, Connecticut.</p>
			<br>
			<p>The interior depicted is the Café de la Gare, 30 Place Lamartine, run by Joseph-Michel Ginoux and his wife Marie, who in November 1888 posed for Van Gogh's and Gauguin's Arlésienne; a bit later, Joseph Ginoux evidently posed for both artists, too.</p>
			<p><a href="https://en.wikipedia.org/wiki/Vincent_van_Gogh">Wikepedia</a></p>
		</div>
	</div>


	<details class="more"><summary>The Night Café</summary></details>
	<div class="show">
		<div class="show-start">
			<p>The Night Café (French: Le Café de nuit) is an oil painting created by Dutch artist Vincent van Gogh in September 1888 in Arles.[1] Its title is inscribed lower right beneath the signature. The painting is owned by Yale University and is currently held at the Yale University Art Gallery in New Haven, Connecticut.</p>
			<br>
			<p>The interior depicted is the Café de la Gare, 30 Place Lamartine, run by Joseph-Michel Ginoux and his wife Marie, who in November 1888 posed for Van Gogh's and Gauguin's Arlésienne; a bit later, Joseph Ginoux evidently posed for both artists, too.</p>
			<p><a href="https://en.wikipedia.org/wiki/Vincent_van_Gogh">Wikepedia</a></p>
		</div>
	</div>
</div>


<div class="slides" id="right">
	<details class="more"><summary>The Night Café</summary></details>
	<div class="show">
		<div class="show-start">
			<p>The Night Café (French: Le Café de nuit) is an oil painting created by Dutch artist Vincent van Gogh in September 1888 in Arles.[1] Its title is inscribed lower right beneath the signature. The painting is owned by Yale University and is currently held at the Yale University Art Gallery in New Haven, Connecticut.</p>
			<br>
			<p>The interior depicted is the Café de la Gare, 30 Place Lamartine, run by Joseph-Michel Ginoux and his wife Marie, who in November 1888 posed for Van Gogh's and Gauguin's Arlésienne; a bit later, Joseph Ginoux evidently posed for both artists, too.</p>
			<p><a href="https://en.wikipedia.org/wiki/Vincent_van_Gogh">Wikepedia</a></p>
		</div>
	</div>


	<details class="more"><summary>The Night Café</summary></details>
	<div class="show">
		<div class="show-start">
			<p>The Night Café (French: Le Café de nuit) is an oil painting created by Dutch artist Vincent van Gogh in September 1888 in Arles.[1] Its title is inscribed lower right beneath the signature. The painting is owned by Yale University and is currently held at the Yale University Art Gallery in New Haven, Connecticut.</p>
			<br>
			<p>The interior depicted is the Café de la Gare, 30 Place Lamartine, run by Joseph-Michel Ginoux and his wife Marie, who in November 1888 posed for Van Gogh's and Gauguin's Arlésienne; a bit later, Joseph Ginoux evidently posed for both artists, too.</p>
			<p><a href="https://en.wikipedia.org/wiki/Vincent_van_Gogh">Wikepedia</a></p>
		</div>
	</div>
</div>

</body>
</html>  
HTML, CSS, Webdesign, Responsive Webdesign

Wie kann ich einen Button nach dem Laden einer Webseite aktiviert aussehen lassen?

Ich habe mir für mein Intranet ein kleines Video-Portal programmiert - das eigentlich ganz gut funktioniert.
Oben gibt es eine aufklappbare Ansicht mit Haupt und Unterkategorien und wenn eine Unter-Kategorie angeklickt wird öffnet sich die Seite mit einer Übersicht relevanter Videos.

Die Haupt-Kategorie gebe ich als URL-Parameter mit -> das funktioniert auch und es wird verdeckt die zu letzt verwendete Hauptkategorie angewählt.

Was nicht funktioniert, ist den Button für die aktuelle Hauptkategorie im Reitermenü so hervor zu heben als wenn er angeklickt wurde - bzw. den Button zu aktivieren.

JavaScript:

function openCity(evt, cityName) {
  // Declare all variables
  var i, tabcontent, tablinks;


  // Get all elements with class="tabcontent" and hide them
  tabcontent = document.getElementsByClassName("tabcontent");
  for (i = 0; i < tabcontent.length; i++) {
    tabcontent[i].style.display = "none";
  }


  // Get all elements with class="tablinks" and remove the class "active"
  tablinks = document.getElementsByClassName("tablinks");
  for (i = 0; i < tablinks.length; i++) {
    tablinks[i].className = tablinks[i].className.replace(" active", "");
  }

PHP-Script:


$cat = "Musik";
if (isset($_GET['cat']))
{
$cat = ($_GET['cat']);
}

echo '<details><summary> Kategorien: </summary>';
echo '<div class="tab">';

echo '<button type="button" name="Musik" class="tablinks" onclick="openCity(event, \'Musik\')">Musik</button>
<button type="button"  name="Anleitungen" class="tablinks" onclick="openCity(event, \'Anleitungen\')">Anleitungen</button>
<button type="button"  name="Kochen" class="tablinks" onclick="openCity(event, \'Kochen\')">Kochen</button>
<button type="button"  name="Backen" class="tablinks" onclick="openCity(event, \'Backen\')">Backen</button>
<button type="button"  name="Heimwerken" class="tablinks" onclick="openCity(event, \'Heimwerken\')">Heimwerken</button>';
  
echo '</div>';

echo '<!-- Tab content -->
<div id="Musik" class="tabcontent">
<div style="column-count: 5;">
'.$category_Musik.'
</div>
</div>

<div id="Anleitungen" class="tabcontent">
<div style="column-count: 5;">
'.$category_Anleitungen.'
</div>
</div>

<div id="Kochen" class="tabcontent">
<div style="column-count: 5;">
'.$category_Kochen.'
</div>
</div>

<div id="Backen" class="tabcontent">
<div style="column-count: 5;">
'.$category_Backen.'
</div>
</div>

<div id="Heimwerken" class="tabcontent">
<div style="column-count: 5;">
'.$category_Heimwerken.'
</div>
</div>';

echo '</details>';

echo '<SCRIPT type="text/javascript" language="JavaScript">
openCity(event, \''.$cat.'\'); 
</SCRIPT>';

CSS-Definitionen:



/* Style the tab */
.tab {
  overflow: hidden;
  border: 1px solid #ccc;
  background-color: #f1f1f1;
}


/* Style the buttons that are used to open the tab content */
.tab button {
  background-color: inherit;
  float: left;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 14px 16px;
  transition: 0.3s;
}


/* Change background color of buttons on hover */
.tab button:hover {
  background-color: #ddd;
}


/* Create an active/current tablink class */
.tab button.active {
  background-color: #ccc;
}


/* Style the tab content */
.tabcontent {
  display: none;
  padding: 6px 12px;
  border: 1px solid #ccc;
  border-top: none;
}

so sieht es aus:

so soll es nach dem Laden der Seite aussehen:

Hat jemand eine Idee wie ich den Button für die aktuelle Kategorie beim Laden der Seite automatisch aktivieren kann?

Bild zum Beitrag
HTML, Webseite, CSS, JavaScript, HTML5, Code, PHP, Webdesign, Webentwicklung

Meistgelesene Beiträge zum Thema Webdesign