I have a splitted layout, like you can see in the following example screens. By default the fixed app vue content takes 40% of the interface left and the router view 60% on the right.
Now the problem: one of the components, in this example router link 3 should be fullscreen. I don't know how the router component can overlap the app vue. It's always beneath it.
router link 1:
router link 2:
router link 3:
Here is my current code
app.vue:
<template>
<div class="left">
<router-link to="/link1">
<router-link to="/link2">
<router-link to="/link3">
</div>
// some content
<router-view></router-view>
</template>
<style>
.left {
width: 40%;
position: fixed;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
</style>
component 1 and 2:
<template>
<div class="container">
// same content
</div>
</template>
<style>
.container {
display: inline-block;
margin-left: 40%;
width: 60%;
height: 100vh;
}
</style>
component 3:
<template>
<div class="container">
// same content
</div>
</template>
<style>
.container {
display: inline-block;
width: 100%;
height: 100vh;
}
</style>
You can use "position: absolute" on the style for the component3. You can also give it a higher z-index to make it appear on top. For example:
<template>
<div class="container">
// same content
</div>
</template>
<style>
.container {
display: inline-block;
position: absolute;
z-index: 100;
width: 100%;
height: 100vh;
}
</style>
You should also be able to use v-bind class to apply a class to a component already displayed on the page. That would give a similar result to what you see in WYSIWYG editors full page option.
Related
I'm asking my first question here, so I apologize in advance if I didn't explain something well.
I'm currently developing portfolio website (Angular 13 with Sass). I've come to a point where I have two divs placed next to each other inside of a flexbox. I use media query (mobile view) to achieve divs to place below each other. One div contains text and other image.
I'm using Sass for flex box
#mixin flex-container($flexdirection, $justifycontent: false) {
#if $justifycontent {
justify-content: $justifycontent;
} #else {
justify-content: center;
}
display: flex;
flex-wrap: wrap;
row-gap: 20px;
align-items: center;
flex-direction: $flexdirection;
}
HTML component looks like this
<div class="about" id="about" #about>
<div class="about__details">
<h1 class="about__title">{{title}}<span class="purple_highlight">A</span>ndjela. <span class="wave">👋</span>
</h1>
<p class="about__paragraph">{{paragraph}}
</p>
<a href="https://drive.google.com/file/d/1PK82zuN4g_Ly5nmNIgRpIsEW9j_gnyaS/view?usp=share_link" target="_blank">
<button class="about__cv_button">My resume</button>
</a>
</div>
<div class="about__img">
<img src="assets/img/profilePicture.png" alt="profile">
</div>
</div>
CSS looks like this
#include mq-between(xs, sm) {
.about {
#include flex-container(row);
height: 100vh;
&__img {
background-color: aqua;
bottom: 0;
right: 0;
flex-shrink: 0;
}
img {
max-width: 100%;
max-height: 100%;
}
&__details {
background-color: blanchedalmond;
left: 10%;
right: 10%;
}
}
}
Result looks like in picture
I've tried using flex-direction as column, flex-basis, max-width, max-height, padding and margin, but nothing seems to make changes for what I'm looking for.
What am I missing to show the divs beneath each other with the correct height?
I'm currently trying to style a page in NextJS. I have an image inside an anchor inside a div. I want to resize the image but no matter what I try, it doesn't seem to work.
I've tried applying properties to all three elements, each one individually, and two at a time.
The relevant code:
<div className={styles.projectContainer}>
<div className={styles.projectDescriptionContainer}>
<h3>Title</h3>
<p>Lorem ipsum etc..</p>
</div>
<div className={styles.projectPhotoContainer}>
<a className={styles.projectLink}
href="heroku link"
target="_blank">
<img src='/local-file.png' />
</a>
</div>
</div>
.projectContainer {
display: inline-block;
width: 100vw;
height: 10vh;
}
.projectDescriptionContainer {
display: inline-block;
width: 20vw;
height: 10vh;
}
.projectPhotoContainer {
display: inline-block;
width: 20vw;
height: 20vh;
}
.projectLink {
display: inline-block;
}
.img {
object-fit: cover;
width: 100%;
height: auto;
}
The link does not have any width size. add:
.projectLink {
display: inline-block;
width:100%;
}
Also, Your object-fit: cover; needs a height. auto won't work
Right, it's been a while this question has been asked, since I was in same situation few days ago and figured this out, I just wanna share it.
You have to work on the anchor tag, make sure to add the inline CSS code:
<a href="example" style="width:100%;" >example- image is here</a>
It will work mate!
I have a series of full-screen divs in Visual Composer and I want an arrow at the bottom of each one indicating to users they should scroll for more content. I tried absolute positioning on the divs containing the icon with no luck. All I've done is move the icon a few pixels to th
<section class="l-section wpb_row height_full valign_center width_full with_img" id="home">
<div class="l-section-img loaded" data-img-width="1920" data-img-height="809">
</div>
<div class="l-section-h i-cf">
<div class="g-cols vc_row type_default valign_top">
<div class="vc_col-sm-12 wpb_column vc_column_container">
<div class="vc_column-inner">
<div class="wpb_wrapper">
<div class="w-image align_center" id="mainlogo">
<div class="w-image-h"><img src="logo.png" class="attachment-full size-full">
</div>
</div>
<div class="ult-just-icon-wrapper">
<div class="align-icon" style="text-align:center;">
<a class="aio-tooltip" href="#whatis">
<div class="aio-icon none " style="display:inline-block;">
<i class="Defaults-chevron-down"></i>
</div>
</a>
</div></div></div></div></div></div></div>
</section>
Existing CSS:
.aio-icon.none {
display: inline-block;
}
.aio-tooltip {
display: inline-block;
width: auto;
max-width: 100%;
}
.vc_column-inner {
display: flex;
flex-direction: column;
flex-grow: 1;
flex-shrink: 0;
}
.wpb_column {
position: relative;
}
.vc_column_container {
display: flex;
flex-direction: column;
}
.vc_row {
position: relative;
}
.l-section-h {
position: relative;
margin: 0 auto;
width: 100%;
}
The icon itself is the Defaults-chevron-down.
Do you have an idea how to position that icon properly?
I also struggled a little with this. But there is a rather quick and dirty fix for this:
Just put another row below the full height row. Place your icon there and give this element a top margin of i.e. -200px.
For some strange reason the rather logical approach to put the icon in the full height row itself and to position it absolute to the bottom is not properly supported by the source generated from WPB.
I had this issue this week. The way I resolved it was added the icon in that row/section (in my case a single image element with a custom link to a .svg) and added a class to it.
The CSS for the class was then:
position:absolute;
margin-left: auto;
margin-right: auto;
left: 0;
right: 0;
text-align: center;
margin-top:-30px;
(I added a negative margin top as I noticed the icon was cutting of a little on my Google Pixel phone with the fixed bottom bar so that pulled it up a little.)
Ok, so this is a simple css question, but I can't seem to find a straight answer on the web to save my life. I've got this set up:
<div id="app">
<div id="header_div"></div>
<div id="menu_div"></div>
<div id="content_div"></div>
</div>
and then some css:
#mixin relPos {
position: relative;
margin-top: 5px;
width: 100%;
}
/*** App level ***/
#app {
position: absolute;
word-wrap: break-word;
height: 100%;
width: 100%;
}
/*** Landing Page ***/
#header_div {
#include blackBorder;
#include relPos;
left: 0;
height: 30%;
}
#menu_div {
#include blackBorder;
#include relPos;
height: 10%;
}
#content_div {
#include blackBorder;
#include relPos;
height: 56%;
overflow: scroll;
}
but the dang divs are not responding to the percentage height style element... any ideas?
For context, I'm building a React.js site so I'm actually using scss files for my styling elements after rending them with React elements. Pretty sure that doesn't matter but just because I don't actually know everything, I'll mention that here. :) Thanks in advance for any help!
- Jon
#top {
position:absolute;
top:0;
left:0;
height: 100%;
width: 100%;
}
#one {
position:relative;
margin-top:1%;
height: 30%;
width: 100%;
background-color:red;
}
#two {
position:relative;
margin-top:1%;
height: 10%;
width: 100%;
background-color:green;
}
#three {
position:relative;
margin-top:1%;
height: 57%; /* not 60% to account for the 5px margin */
width: 100%;
background-color:blue;
}
<div id="top">
<div id="one"></div>
<div id="two"></div>
<div id="three"></div>
</div>
Instead of using multiple position: relative; use the float: property across for cleaner code.
You can achieve this cleanly with 3 float:left;. Keep the parent div position:relative; and the 3 inner, float:left;. Nest another div around all these elements with your position:absolute; if still necessary.
So here's my React code:
import React from 'react';
import ReactDOM from 'react-dom';
class LandingPage extends React.Component
{
render()
{
return(
<div>
<div id="header_div">
<h1> Header picture goes here </h1>
</div>
<div id="menu_div">
<h2> here's for the menu buttons </h2>
</div>
<div id="content_div">
<h3> and... the content to be loaded based on first load or menu button mash </h3>
</div>
</div>
);
}
};
export default LandingPage;
And because I'm using react elements, I had to return one div with the three I'm trying to style in it for my LandingPage element... so my structure was actually ... and so on. Because of this, the container div was not app and there for it didn't matter if I did my styling on app, I needed to do it on the other div in the middle. I added a id="main" to the middle div and styled it as I had my #app styled... Once I did, it was all good! Thanks guys!
I'm using the jQuery Cycle plugin to rotate images in a slideshow type fashion. That works fine. The problem I'm having is getting these images (of different sizes) to center in the containing div. The images are inside a slidshow div that has it's position set to absolute by the Cycle plugin.
I've tried setting line-height/vertical-align and whatnot but no dice. Here is the relevant HTML and CSS
HTML:
<div id="projects">
<div class="gallery">
<span class="span1">â—„</span><span class="span2">â–º</span>
<div class="slideshow">
<img src="images/img1.png" />
<img src="images/img1.png" />
<img src="images/img1.png" />
</div>
</div>
</div>
CSS:
#main #home-column-2 #projects
{
width: 330px;
background: #fefff5;
height: 405px;
padding: 12px;
}
#main #home-column-2 #projects .gallery
{
width: 328px;
height: 363px;
position: relative;
background: url('images/bg-home-gallery.jpg');
}
#main #home-column-2 #projects .gallery img
{
position: relative;
z-index: 10;
}
And in case you want to see it, the jQuery:
$('#home-column-2 #projects .gallery .slideshow').cycle(
{
fx: 'scrollHorz',
timeout: 0,
next: "#home-column-2 #projects .gallery span.span2",
prev: "#home-column-2 #projects .gallery span.span1"
});
Any ideas on getting these images to center?
Try this:
http://www.brunildo.org/test/img_center.html
Vertical centering is a pain! Here's what the W3C page says about the vertical center:
CSS level 2 doesn't have a property
for centering things vertically. There
will probably be one in CSS level 3.
But even in CSS2 you can center blocks
vertically, by combining a few
properties. The trick is to specify
that the outer block is to be
formatted as a table cell, because the
contents of a table cell can be
centered vertically.
This method involves a little jquery, but works fantastic in most situations...
let me explain:
if all the images of the slideshow are contained within their own element div pos:absolute and those images are pos:relative, then on a $(window).load() you can run a .each() and find each img in the slideshow and adjust it's top positioning to be offset a certain number of pixels from the top..
jcycle automatically sets each parent div containing the image to pos:absolute on every onafter() so it's useless to apply this pos adjustment to them... instead target each img you have set to pos:relative...
Here is the example:
$(window).load(function() {
// move all slides to the middle of the slideshow stage
var slideshowHeight = 600; //this can dynamic or hard-coded
$('.slideImg').each(function(index) {
var thisHeight = $(this).innerHeight();
var vertAdj = ((slideshowHeight - thisHeight) / 2);
$(this).css('top', vertAdj);
});
});
and this is the html it's working on...
<div class="slideshow" style="position: relative; ">
<div style="position: absolute; top: 0px; left: 0px; display: none; width: 1000px; height: 600px; " id="img0">
<img class="slideImg" src="/images/picture-1.jpg" style="top: 0px; "><!-- the style=top:0 is a result of the jquery -->
</div>
<div style="position: absolute; top: 0px; left: 0px; display: none; width: 1000px; height: 600px; " id="img1">
<img class="slideImg" src="/images/picture-1.jpg" style="top: 89.5px; "><!-- the style=top:89.5px is a result of the jquery -->
</div>
<div style="position: absolute; top: 0px; left: 0px; display: none; width: 1000px; height: 600px; " id="img2">
<img class="slideImg" src="/images/picture-1.jpg" style="top: 13px; "><!-- the style=top:13px is a result of the jquery -->
</div>
</div>
just make sure
.slideImg {
position:relative;
}
I think that's everything... I have an example, but it's on a dev site.. so this link might not last.. but you can take a look at it here:
http://beta.gluemgmt.com/portfolio/rae-scarton-editorial.html
The positions are relative according to the style sheet, so did you try setting them to display: block and margin-top: auto; margin-bottom: auto; ?
Another option is to align them manually in javascript based on the containing div's height.
You need to nest two divs inside each cycle item. The first must have the display: inline-table; and the second must have display: table-cell; both these divs have vertical-align: middle.
So the structure would look something like this:
<div class="slide-container">
<div class="slide">
<div class="outer-container">
<div class="inner-container">
Centered content
</div>
</div>
</div>
<div class="slide">
<div class="outer-container">
<div class="inner-container">
Centered content
</div>
</div>
</div>
</div>
With the following css:
.slide-container {
height: 300px;
}
.outer-container {
height: 300px;
display: inline-table;
vertical-align: middle;
}
.inner-container{
vertical-align: middle;
display: table-cell;
}
You can see it working here http://jsfiddle.net/alsweeet/H9ZSf/6/