I have two block. One of them triangular shaped. How make to flow around this div text? Example:
HTML:
<div class="container">
<div class="entry-cover">Triangle</div>
<div class="entry-content">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Assumenda autem ex
labore, repellat saepe soluta suscipit vel veniam.</p>
</div>
</div>
CSS has no!
You can use css shapes. Read this http://webplatform.adobe.com/shapes/.
You have to know that it's not cross browsers.
http://caniuse.com/#feat=css-shapes
EDIT - there is polyfill by Adobe, check this out.
https://github.com/adobe-webplatform/css-shapes-polyfill
So if your website need to cross browsers, you have to layout it with css (padding, margin, etc.) or spaces.
Why don't you use skew to the div which contains text. , might help. Other solution : You can use  
Related
This question already has answers here:
How to have to background images side by side in CSS
(3 answers)
Closed 2 years ago.
I'm trying to place 2 images side to side and have some text in the center of both images, but after adding the first image in CSS with background :(url) , I cannot add a second image because it just overrides the first one and I put images directly in a div , I cannot place text inside them.
As you can see in the below HTML that if I put one image in HTML and I through CSS, I cannot place text over it and if I place it in the CSS ,they just override each other.
HTML and CSS
#image{
height: 400px;
background-color: black;
background: url("https://www.dizzion.com/wp-content/uploads/2017/06/Working-on-Laptop-x1200-1024x683.jpg");
}
<section id="images">
<h1>affortable shit</h1>
<p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Ex quae nisi aliquid, saepe eaque ad repudiandae hic minus commodi tempore.</p>
<img src="https://media.sproutsocial.com/uploads/2017/02/10x-featured-social-media-image-size.png" alt="">
</section>
Screenshot Just replace your code with this.
Use a section tag selector in css
section{
height: 400px;
background-color: black;
background-image: url(https://www.dizzion.com/wp-content/uploads/2017/06/Working-on-Laptop-x1200-1024x683.jpg);
}
<section id="images">
<h1>affortable shit</h1>
<p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Ex quae nisi aliquid, saepe eaque ad repudiandae hic minus commodi tempore.</p>
<img src="https://media.sproutsocial.com/uploads/2017/02/10x-featured-social-media-image-size.png" alt="">
</section>
I have a classic structure of html code with bootstrap 4. i want to put a background-color in full width of panel in a col-8. here is my code :
<div class="container">
<div class="col-8">
<div class="row">
</div>
<div class="row my-panel">
<!-- i want to fill this panel with a full width background color-->
</div>
</div>
<div class="col-4">
<!-- a sticky top panel which vertically scroll with the page-->
</div>
</div>
The problem is my-panel is not on full width because the col-8 is the parent and what i want to do is to fill my-panel with a color but not only for the width of the col-8 but i want to fill 100% of the screen's width
First of all your question is not clear, but since you say you edited it I tried my best to understand the question.
Bootstrap works in a grid system. So if you set a class as col-4 it'll set up a small box (column) inside this grid to let you throw in your elements in. The rest of this row will remain empty. Furthermore, due to HTML divs works in a parent/child sense, if you add a col-8 inside a container and tried adding width:100%; (CSS) in the col-8 and expected to see a stretched container, it simply won't work.
So, you have to edit that container's css attributes. But I would suggest you make another parent div before the container and add css into it.
I think what you want to do something similar to the below image.
I've added background colours to the divs, so you might be able to understand what I've done here. Also, I believe that this way your question of adding background colours, might be answered.
Here's my code:
<body>
<div style="background-color: green;">
<div style="background-color: blue;">
<div class="container">
<div class="col-8" style="background-color: red; width: 100%;">
<div class="row" >
</div>
<div class="row my-panel">
<!-- i want to fill this panel with a full width background color -->
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Maiores iusto consectetur,
aliquid laborum dicta nobis magni atque voluptatem ullam, natus deserunt, animi corrupti sunt nesciunt fugiat asperiores nam delectus quam.
</div>
</div>
</div>
</div>
<div class="col-4" style="background-color: yellow;">
<!-- a sticky top panel which vertically scroll with the page -->
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Maiores iusto consectetur,
aliquid laborum dicta nobis magni atque voluptatem ullam, natus deserunt, animi corrupti sunt nesciunt fugiat asperiores nam delectus quam.
</div>
</div>
</body>
I have a situation where I will have a lot of content that has a heading in small text, and directly below it will be a longer heading (sometimes even a sentence) in much larger text, followed by the standard paragraph text. Here is an example of what I'm talking about:
body {
font-family: Arial, sans-serif;
max-width: 400px;
margin: 0 auto;
}
h2 {
font-size: 12px;
text-transform: uppercase;
margin: 20px 0 10px;
}
.tagline {
margin: 0 0 20px 0;
font-size: 24px;
}
<h2>Section Title</h2>
<p class="tagline">A tagline... Lorem ipsum dolor sit amet, consectetur adipisicing elit. Atque.</p>
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Quos dolorem delectus neque est quidem numquam, incidunt corporis temporibus alias fuga.</p>
My initial instinct is to make the first part the heading element via <h2> and make the second section into a paragraph (as you can see in my example). But would this be correct? The larger text is definitely what people will most likely read first, but the smaller text is a better title for the section.
My question is am I good with this or should I swap it and make the small text a paragraph and the large text the heading tag?
In addition, I'm wondering if I should also be wrapping these two "headings" into a <header> tag as well?
Main Rule when dealing with HTML semantics is never work on the presentation part with HTML. That's the reason why we do have CSS.
Present days all websites are modifying there HTML semantics to meet WCAG standards. In simple words, those are some standards which when followed by developers helps people with accessibility problems access the web with ease.
For more details : https://www.w3.org/WAI/standards-guidelines/wcag/
So I suggest keeping the heading and sub-heading in the right way with right semantics. Think of a presentation in terms of CSS.
I'm not sure if this is the answer you are looking for, but I hope this helps to make a decision..
Reading the HTML spec on whatwg.org, this seems to be exactly what the hgroup element is for. In your case, the "correct" markup would be something like:
<hgroup>
<h2>Section Title</h2>
<h3>A tagline... Lorem ipsum dolor sit amet, consectetur adipisicing elit. Atque.</h3>
</hgroup>
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Quos dolorem delectus neque est quidem numquam, incidunt corporis temporibus alias fuga.</p>
The hgroup tag basically lets you write more than one header element while only "counting" the first one for document outline purposes. The subsequent ones are only aesthetic. Example use cases according to the spec are "subtitles", "taglines" etc.
Why not use hierarchy of headings? In your example, if tag line is a heading you should put that behind h3.
Screen readers don’t present CSS to users so ask yourself, “does the content ‘structure’ still make sense when css is reduced?” If you use proper semantics then the structure will be preserved but with mocking styles (like heading style applied to a p tag) will lose its meaning when CSS is removed. Meaning screen readers would just present the tag line as paragraph text vs. presenting it as a sub heading. People navigate or jump through headings using screen readers so p tag tag line will not be in their heading navigation.
Does that make sense? Happy to clarify anything confusing.
I've been researching and trying for ages now and it kind of drives me crazy, that I am not able to solve this seemingly simple problem.
I've been trying to fit headings in blogpost-previews to the same height using flexbox. If a heading is "too long" it gets a line-break and has a greater height than the shorter ones, which is okay. However, the paragraph below the heading don't start on the same height anymore, which just looks very odd. Is there a simple way to achieve this, preferably with flexbox?
Here is an image of what I am trying to achieve:
Here is a link to the code on codepen
<div class="blogpost-container">
<div class="blogpost">
<header class="blogpost__header">
<div class="dummy-image"></div>
<h1>Blogpost heading short</h1>
</header>
<div class="blogpost__content">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Graecum enim hunc versum nostis omnes: Suavis laborum est praeteritorum memoria.
Ergo instituto veterum, quo etiam Stoici utuntur, hinc capiamus exordium.</p>
</div>
</div>
<div class="blogpost">
<header class="blogpost__header">
<div class="dummy-image"></div>
<h1>Blogpost Heading is longer and thus has a greater height than the short one</h1>
</header>
<div class="blogpost__content">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Graecum enim hunc versum nostis omnes: Suavis laborum est praeteritorum memoria.
Ergo instituto veterum, quo etiam Stoici utuntur, hinc capiamus exordium.</p>
</div>
</div>
</div>
Thank you very much in advance for your help.
Get the Fiddle: https://jsfiddle.net/4sew4x2m/
I used <table>. But you can use display:table instead.
From my point of view, if you you flex, you have to give width for that divs. In case of using tables, you don't have to- that's the advantage.
Good luck!
I use this template for my website skin. In this section of press have two div that contain text and image.I want change position of image and text. The image placed in left side and texts placed in right side. My site skin has rtl direction.
<div class="fh5co-press-item to-animate fadeInUp animated">
<div class="fh5co-press-img" style="background-image: url(/DNN_test/Portals/_default/Skins/Crew/images/img_8.jpg)"></div>
<div class="fh5co-press-text">
<h3 class="h2 fh5co-press-title">Versatile <span class="fh5co-border"></span></h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Veritatis eius quos similique suscipit dolorem cumque vitae qui molestias illo accusantium...</p>
<p>Learn more</p>
</div>
</div>
On .fh5co-press-img and .fh5co-press-text you can set the order property. Add the following CSS:
.fh5co-press-text {
order:2;
position: relative;
}
.fh5co-press-img {
order:1;
position: relative;
}
You are using position:absolute; for the elements, you have to add position:relative;.