I'm new in css
I create two columns using flexbox, so I want to divide them 50% and 50%.
blockquote {
font-family: Georgia, serif;
font-size: 18px;
font-style: italic;
color: #383838;
border-right: 1px solid gray;
}
blockquote:before {
display: block;
content: "\201C";
font-size: 80px;
color: #0e4f1f;
text-align: center;
}
#about-us{
display: flex;
}
.about-us__slogan{
margin:6em 0 0 2em;
text-align: center;
}
.about-us__business{
flex:50%;
}
.about-us__business__title{
color:#0e4f1f;
margin: 2em 0 0 2em;
}
.about-us__business__info{
text-align:left;
}
<section id="about-us">
<p class="about-us__slogan"><blockquote>
“Neque porro quisquam est qui dolorem <br/>
Neque porro quisquam est qui dolorem<br/>
Neque porro quisquam est qui dolorem<br/>
Neque porro quisquam est qui dolorem.</p>
</blockquote>
<div class="about-us__business">
<h1 class="about-us__business__title">Neque porro quisquam est qui dolorem</h1>
<p class="about-us__business__info">Neque porro quisquam est qui dolorem ipsum quia dolor sit amet,
Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit.
porro.</p>
<p>Neque porro quisquam est qui dolorem ipsum quia dolor sit amet
Neque porro quisquam est qui dolorem ipsum quia dolor sit amet
Neque porro quisquam est qui dolorem ipsum quia dolor sit amet
Neque porro quisquam est qui dolorem ipsum quia dolor sit amet
pNeque porro quisquam est qui dolorem ipsum quia dolor sit amet.</p>
</div>
</section>
As you can see it's not 50% and 50%, I try using flex:50%. in .about-us__slogan class but it no work, it just create big space at the left.
I think it's not that dimensions because size wrap to the content, how can I fix that? Regards
Your child divs about-us__slogan & about-us__business both needed to be flex:1 so they are equal in size to each other with their parent div about-us with display: flex.
Some of your nesting had also got a little messed up in your example code above so I have tidied it a little for you also.
Try this:
.about-us {
display: flex;
}
.about-us__slogan {
flex: 1;
margin: auto 1rem;
border-right: 1px solid gray;
}
.about-us__blockquote {
font-family: Georgia, serif;
font-size: 18px;
font-style: italic;
color: #383838;
text-align: center;
margin: 0;
}
.about-us__blockquote:before {
display: block;
content: "\201C";
font-size: 80px;
color: #0e4f1f;
}
.about-us__business {
flex: 1;
margin: auto 1rem;
}
.about-us__business-title {
color: #0e4f1f;
}
.about-us__business-info {
/* Add styles you would like to use if any */
}
<section class="about-us">
<div class="about-us__slogan">
<blockquote class="about-us__blockquote">
<p class="about-us__slogan-text">
Neque porro quisquam est qui dolorem Neque porro quisquam est qui dolorem Neque porro quisquam est qui dolorem Neque porro quisquam est qui dolorem.</p>
</blockquote>
</div>
<div class="about-us__business">
<h1 class="about-us__business-title">Neque porro quisquam est qui dolorem</h1>
<p class="about-us__business-info">Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit. porro.</p>
<p class="about-us__business-info">Neque porro quisquam est qui dolorem ipsum quia dolor sit amet Neque porro quisquam est qui dolorem ipsum quia dolor sit amet Neque porro quisquam est qui dolorem ipsum quia dolor sit amet Neque porro quisquam est qui dolorem ipsum quia dolor sit
amet pNeque porro quisquam est qui dolorem ipsum quia dolor sit amet.</p>
</div>
</section>
Related
I styled some text to have a faint white text-shadow so that when it passes on a same-color background, it's style legible. The issue comes in that when I select the text, it becomes difficult to read thanks to the text-shadow being the same color as the text.
body {
background-color: #CCC;
margin: 0px;
}
div {
padding: 1.5em;
}
div + div {
margin: 2em 0 0;
}
div p:last-child {
margin: 0em;
}
p {
text-shadow: 0 0 3px #FFF;
margin: 0 0 1em;
}
.actual-effect ::selection {
text-shadow: none;
}
.intended-effect p {
text-shadow: none;
}
<div class="actual-effect">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Optime, inquam. Istam voluptatem, inquit, Epicurus ignorat? Inde igitur, inquit, ordiendum est. Eam tum adesse, cum dolor omnis absit; Ne discipulum abducam, times. </p>
<p><i>Certe non potest.</i> <mark>Honesta oratio, Socratica, Platonis etiam.</mark> Duo Reges: constructio interrete. Recte dicis; Hoc loco tenere se Triarius non potuit. </p>
<p>Non igitur bene. Utram tandem linguam nescio? <b>Quis est tam dissimile homini.</b> Quae sequuntur igitur? Quod ea non occurrentia fingunt, vincunt Aristonem; Hoc ipsum elegantius poni meliusque potuit. </p>
</div>
<div class="intended-effect">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Optime, inquam. Istam voluptatem, inquit, Epicurus ignorat? Inde igitur, inquit, ordiendum est. Eam tum adesse, cum dolor omnis absit; Ne discipulum abducam, times. </p>
<p><i>Certe non potest.</i> <mark>Honesta oratio, Socratica, Platonis etiam.</mark> Duo Reges: constructio interrete. Recte dicis; Hoc loco tenere se Triarius non potuit. </p>
<p>Non igitur bene. Utram tandem linguam nescio? <b>Quis est tam dissimile homini.</b> Quae sequuntur igitur? Quod ea non occurrentia fingunt, vincunt Aristonem; Hoc ipsum elegantius poni meliusque potuit. </p>
</div>
I'm not sure how other browsers render this, but currently in Firefox it accurately removes the text-shadow, but it loses all of the default stylings it would have had had I not changed it (ie. white text, blue background, inverted colors when juxtaposed against a certain backgrounds, etc).
Is there a way to modify ::selection without losing all of the default values? I'd rather not re-add all of the default styles unless that were the only option available.
The issue isn't avoiding that the text-shadow makes things difficult to read, it's more-so trying to avoid p::selection from losing everything else.
Sorry for previous answer 😔🙏.
You can set the text-shadow to 0 0 0.
Example :
body {
background-color: #CCC;
margin: 0px;
padding: 1.5em;
}
p {
text-shadow: 0 0 3px #FFF;
margin: 0 0 1em;
}
::selection {
text-shadow: 0 0 0 !important;
}
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Optime, inquam. Istam voluptatem, inquit, Epicurus ignorat? Inde igitur, inquit, ordiendum est. Eam tum adesse, cum dolor omnis absit; Ne discipulum abducam, times. </p>
<p><i>Certe non potest.</i> <mark>Honesta oratio, Socratica, Platonis etiam.</mark> Duo Reges: constructio interrete. Recte dicis; Hoc loco tenere se Triarius non potuit. </p>
<p>Non igitur bene. Utram tandem linguam nescio? <b>Quis est tam dissimile homini.</b> Quae sequuntur igitur? Quod ea non occurrentia fingunt, vincunt Aristonem; Hoc ipsum elegantius poni meliusque potuit. </p>
Previous Answer (unsatisfactory)
It's because background, change that. I'm try use background-color: transparent, but it's not work. So, in this code i use background-color: #fff.
p {
text-shadow: 2px 2px #FF0000;
}
p::selection {
background-color: #fff;
text-shadow: none;
}
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Autem numquam, laboriosam distinctio impedit qui explicabo corporis optio commodi officiis ratione voluptates corrupti, temporibus iusto recusandae facilis nobis obcaecati nisi quisquam iste ullam excepturi iure. Ratione, molestiae mollitia vitae, error soluta illum ex accusamus voluptatem tempora hic aut rerum! Recusandae impedit consectetur consequatur dolorum, dolore aut officiis nam tenetur aliquid repudiandae natus velit sapiente vero esse, dolor quasi illo at consequuntur aperiam explicabo iusto corporis ex fugit architecto? Placeat, unde suscipit expedita enim ab vel iste cumque quas, asperiores adipisci accusamus? Et, minus. Saepe magni quo, ipsam enim earum placeat voluptates.</p>
I have this css and its working fine the text appears at right and is aligned.
However the same code of that fiddle in a pdf, the text is apeparing like this (like the example at right, at left is how it should display):
Do you know what can be the issue?
.container {
display: flex;
}
.span {
margin-right: 5px;
}
<div class="container">
<span class="span">1.</span>
<span>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sint vel aut quidem consequatur quaerat optio ab! Iste fugit nostrum odio dolorum sequi, odit ratione omnis, atque sunt perferendis commodi, iure.</span>
</div>
You can solve this problem by using text-align
.container {
display: flex;
text-align: justify;
text-justify: inter-word;
}
.span {
margin-right: 5px;
}
<div class="container">
<span class="span">1.</span>
<span>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sint vel aut quidem consequatur quaerat optio ab! Iste fugit nostrum odio dolorum sequi, odit ratione omnis, atque sunt perferendis commodi, iure.</span>
</div>
#mehran text-justify:inter-word; is not a valid CSS property
I'm trying to make a navigation bar with pure HTML and CSS which doesn't require any JavaScript to open and close.
I'm having an issue with the navigation bar remaining open. When I set display: none or visibility: hidden to get desired functionality, the hyperlink doesn't function anymore.
http://codepen.io/anon/pen/dOMYEj
Is this possible? Thanks!
when you use display:flex ,position:absolute ,relative and fixed does not behave as expected.check this link
Modified markup and css a bit .please check the following snippet
* {
font-family: sans-serif;
}
nav {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
background-color: white;
align-items: center;
box-sizing: border-box;
box-shadow: 0 0 2px rgba(128, 128, 128, 0.5);
}
nav div {
height: 5vh;
width: 10vw;
position: fixed;
top: 0;
padding: 3px;
right: 0;
}
.icon {
display: inline;
}
nav > h1 {
font-family: cursive;
font-size: 1.2rem;
padding-left: 10px;
color: blue;
}
nav li {
list-style: none;
display: inline;
font-size: 1.2rem;
padding: 10px;
cursor: pointer;
}
nav a {
color: darkgray;
text-decoration: none;
}
nav a:hover {
color: black;
}
nav a:active {
color: blue;
}
nav li:first-child * {
color: blue;
}
nav ul {
width: 50vw;
}
nav h1,
nav ul {
font-size: 2rem;
}
nav > input {
display: none;
}
nav > label {
display: none;
}
input {
display: none;
}
section {
font-size: 2rem;
padding: 1vh 5vh 0 5vh;
}
section#top {
margin-top: 5.5vh;
}
#media (max-width: 5000px) {
/* changed to 5000 so it is always collapsed */
nav {
height: 6vh;
text-align: center;
justify-content: space-between;
}
nav li {
display: block;
border: solid 1px blue;
margin: 0 auto;
}
#links {
visibility: hidden;
}
section#top {
margin-top: 10vh;
}
input:checked + nav ul#links {
visibility: visible;
position: absolute;
right: 30px;
}
input:not:checked +nav ul#links {
visibility: hidden;
}
nav {
color: blue;
}
}
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="taco.css">
<title>Test Page</title>
</head>
<input type='checkbox' id='one'>
<nav class="toggleable" tabindex="1">
<h1>Test Page</h1>
<div>
<label for="one">☰</label>
<ul id="links">
<li>Home
</li>
<li>About
</li>
<li>Menu
</li>
<li>Hours
</li>
<li>Directions
</li>
<li>Contact
</li>
</ul>
</div>
</nav>
<main>
<section id="top">
<h1>Welcome</h1> awefore ipsa laudantium, magnam maxime perspiciatis quam quia rem repudiandae ut velit voluptas! Lorem ipsum dolor sit amet, consectetur adipisicing elit. Atque aut earum eligendi, error eum explicabo ipsum itaque laudantium modi, odit placeat quia
reprehenderit tempora! Alias harum libero reiciendis repellendus rerum!lorem Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusamus ad dolorem incidunt iure laboriosam libero nihil nostrum nulla, numquam placeat quaerat repellendus totam
voluptatem. Ad aliquid dolorum excepturi expedita nostrum.
</section>
<section id="about">
<h1>About</h1> Lorem ipsum doloraweghawehectetur adipisicing elit. Accusamus at blanditiis commodi consequuntur delectus doloribus expedita fugit inventore ipsa laudantium, magnam maxime perspiciatis quam quia rem repudiandae ut velit voluptas! Lorem ipsum dolor
sit amet, consectetur adipisicing elit. Atque aut earum eligendi, error eum explicabo ipsum itaque laudantium modi, odit placeat quia reprehenderit tempora! Alias harum libero reiciendis repellendus rerum!lorem Lorem ipsum dolor sit amet, consectetur
adipisicing elit. Accusamus ad dolorem incidunt iure laboriosam libero nihil nostrum nulla, numquam placeat quaerat repellendus totam voluptatem. Ad aliquid dolorum excepturi expedita nostrum.
</section>
<section id="menu">
<h1>Menu</h1> Lorem ipsum dolor styktyktyktyking elit. Accusamus at blanditiis commodi consequuntur delectus doloribus expedita fugit inventore ipsa laudantium, magnam maxime perspiciatis quam quia rem repudiandae ut velit voluptas! Lorem ipsum dolor sit amet,
consectetur adipisicing elit. Atque aut earum eligendi, error eum explicabo ipsum itaque laudantium modi, odit placeat quia reprehenderit tempora! Alias harum libero reiciendis repellendus rerum!lorem Lorem ipsum dolor sit amet, consectetur adipisicing
elit. Accusamus ad dolorem incidunt iure laboriosam libero nihil nostrum nulla, numquam placeat quaerat repellendus totam voluptatem. Ad aliquid dolorum excepturi expedita nostrum.
</section>
<section id="hours">
<h1>Hours</h1> Lorem ipsum dolor sit rtyr657456ydfghfvgyjktyuicing elit. Accusamus at blanditiis commodi consequuntur delectus doloribus expedita fugit inventore ipsa laudantium, magnam maxime perspiciatis quam quia rem repudiandae ut velit voluptas! Lorem ipsum
dolor sit amet, consectetur adipisicing elit. Atque aut earum eligendi, error eum explicabo ipsum itaque laudantium modi, odit placeat quia reprehenderit tempora! Alias harum libero reiciendis repellendus rerum!lorem Lorem ipsum dolor sit amet, consectetur
adipisicing elit. Accusamus ad dolorem incidunt iure laboriosam libero nihil nostrum nulla, numquam placeat quaerat repellendus totam voluptatem. Ad aliquid dolorum excepturi expedita nostrum.
</section>
<section id="directions">
<h1>Directions</h1> Lorem ipsuaw4yae4yah34rtaw3789t. Accusamus at blanditiis commodi consequuntur delectus doloribus expedita fugit inventore ipsa laudantium, magnam maxime perspiciatis quam quia rem repudiandae ut velit voluptas! Lorem ipsum dolor sit amet, consectetur
adipisicing elit. Atque aut earum eligendi, error eum explicabo ipsum itaque laudantium modi, odit placeat quia reprehenderit tempora! Alias harum libero reiciendis repellendus rerum!lorem Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Accusamus ad dolorem incidunt iure laboriosam libero nihil nostrum nulla, numquam placeat quaerat repellendus totam voluptatem. Ad aliquid dolorum excepturi expedita nostrum.
</section>
<section id="contact">
<h1>Contact</h1> Lorem ipsum dolor 3456345789ru8ghiuretur adipisicing elit. Accusamus at blanditiis commodi consequuntur delectus doloribus expedita fugit inventore ipsa laudantium, magnam maxime perspiciatis quam quia rem repudiandae ut velit voluptas! Lorem ipsum
dolor sit amet, consectetur adipisicing elit. Atque aut earum eligendi, error eum explicabo ipsum itaque laudantium modi, odit placeat quia reprehenderit tempora! Alias harum libero reiciendis repellendus rerum!lorem Lorem ipsum dolor sit amet, consectetur
adipisicing elit. Accusamus ad dolorem incidunt iure laboriosam libero nihil nostrum nulla, numquam placeat quaerat repellendus totam voluptatem. Ad aliquid dolorum excepturi expedita nostrum.
</section>
</main>
</html>
Hope it helps
I was able to finally create it. I really hope this helps someone out.
HTML:
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="taco.css">
<title>Test Page</title>
</head>
<nav>
<header><h1>Test Site</h1></header>
<div id="navigation">
<button>☰</button>
<ul id="links">
<li>Home
</li>
<li>About
</li>
<li>Menu
</li>
<li>Hours
</li>
<li>Directions
</li>
<li>Contact
</li>
</ul>
</div>
</nav>
<main>
<section id="top">
<h1>Welcome</h1> Lorem ipsum dolor sit amet, consectetur adipisicing elit. Incidunt consectetur suscipit in, vitae voluptas, dolorum consequatur sequi animi deserunt maxime quae sint dolorem dolores aliquid totam qui architecto ab beatae.
reprehenderit tempora! Alias harum libero reiciendis repellendus rerum!lorem Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusamus ad dolorem incidunt iure laboriosam libero nihil nostrum nulla, numquam placeat quaerat repellendus totam
voluptatem. Ad aliquid dolorum excepturi expedita nostrum.
</section>
<section id="about">
<h1>About</h1> Lorem ipsum doloraweghawehectetur adipisicing elit. Accusamus at blanditiis commodi consequuntur delectus doloribus expedita fugit inventore ipsa laudantium, magnam maxime perspiciatis quam quia rem repudiandae ut velit voluptas! Lorem ipsum dolor
sit amet, consectetur adipisicing elit. Atque aut earum eligendi, error eum explicabo ipsum itaque laudantium modi, odit placeat quia reprehenderit tempora! Alias harum libero reiciendis repellendus rerum!lorem Lorem ipsum dolor sit amet, consectetur
adipisicing elit. Accusamus ad dolorem incidunt iure laboriosam libero nihil nostrum nulla, numquam placeat quaerat repellendus totam voluptatem. Ad aliquid dolorum excepturi expedita nostrum.
</section>
<section id="menu">
<h1>Menu</h1> Lorem ipsum dolor sit amet, consectetur adipisicing elit. Illum magnam quo quia quod eius aliquam adipisci molestias vel, sapiente ex nobis, eligendi a inventore nihil sit aut molestiae voluptatibus culpa.
</section>
<section id="hours">
<h1>Hours</h1> Lorem ipsum dolor sit amet, consectetur adipisicing elit. Veniam iste consequatur impedit, voluptatum saepe vero harum quod, repudiandae maxime dolorum non. Adipisci, tempore, quisquam! Est dolorem obcaecati distinctio explicabo veritatis!Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dicta deserunt adipisci, debitis dolor ex consectetur iusto repellat molestias velit suscipit laudantium enim quae autem eveniet repudiandae sit. Facilis, quis, at.
dolor sit amet, consectetur adipisicing elit. Atque aut earum eligendi, error eum explicabo ipsum itaque laudantium modi, odit placeat quia reprehenderit tempora! Alias harum libero reiciendis repellendus rerum!lorem Lorem ipsum dolor sit amet, consectetur
adipisicing elit. Accusamus ad dolorem incidunt iure laboriosam libero nihil nostrum nulla, numquam placeat quaerat repellendus totam voluptatem. Ad aliquid dolorum excepturi expedita nostrum.
</section>
<section id="directions">
<h1>Directions</h1> Lorem ipsum dolor sit amet, consectetur adipisicing elit. Illum, ipsam, optio reiciendis sit quidem beatae consequatur alias nulla labore! Vel quibusdam neque consequatur est tempora quas omnis placeat ab ex.Lorem ipsum dolor sit amet, consectetur adipisicing elit. Obcaecati, sit amet dolores. Nobis corrupti nihil, officiis maiores eligendi modi quo, minus? Expedita, corrupti ullam nobis cum, quibusdam ipsa quo ex!
adipisicing elit. Atque aut earum eligendi, error eum explicabo ipsum itaque laudantium modi, odit placeat quia reprehenderit tempora! Alias harum libero reiciendis repellendus rerum!lorem Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Accusamus ad dolorem incidunt iure laboriosam libero nihil nostrum nulla, numquam placeat quaerat repellendus totam voluptatem. Ad aliquid dolorum excepturi expedita nostrum.
</section>
<section id="contact">
<h1>Contact</h1> Lorem ipsum dolor sit amet, consectetur adipisicing elit. Obcaecati minus ducimus fuga qui dignissimos reiciendis voluptatibus ea iusto dolorem doloribus eius similique impedit, molestiae consequuntur non ratione enim, ullam laboriosam. Lorem ipsum
dolor sit amet, consectetur adipisicing elit. Atque aut earum eligendi, error eum explicabo ipsum itaque laudantium modi, odit placeat quia reprehenderit tempora! Alias harum libero reiciendis repellendus rerum!lorem Lorem ipsum dolor sit amet, consectetur
adipisicing elit. Accusamus ad dolorem incidunt iure laboriosam libero nihil nostrum nulla, numquam placeat quaerat repellendus totam voluptatem. Ad aliquid dolorum excepturi expedita nostrum.
</section>
</main>
</html>
CSS:
* {
font-family: sans-serif;
}
nav {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
background-color: white;
align-items: center;
box-sizing: border-box;
box-shadow: 0 0 2px rgba(128, 128, 128, 0.5);
}
nav div#navigation {
height: 5vh;
width: 10vw;
position: fixed;
top: 1vh;
padding: 1vw;
right: 25vw;
}
.icon {
display: inline;
}
nav header {
top: 1vw;
left: 1vw;
position: fixed;
}
nav header > h1 {
background-color: rgba(255, 255, 255, .5);
font-family: cursive;
font-size: 2rem;
padding-left: 1vw;
color: blue;
left: 0;
}
nav li {
list-style: none;
display: inline;
font-size: 1.2rem;
padding: 1vh;
cursor: pointer;
}
nav li:focus {
color: blue;
}
nav a {
color: darkgray;
text-decoration: none;
}
nav a:hover {
color: black;
}
nav a:active {
color: blue;
}
nav li:first-child * {
color: blue;
}
nav ul {
width: 50vw;
}
nav h1,
nav ul {
font-size: 2rem;
}
nav #links {
background-color: rgba(255, 255, 255, .9);
}
button {
display: none;
}
input {
display: none;
}
section {
font-size: 2rem;
padding: 1vh 5vh 0 5vh;
}
section#top {
margin-top: 5.5vh;
}
section > h1 {
margin-top: 8vh;
color: blue;
}
/* Changed to 9999px so it's always collapsed */
#media (max-width: 9999px) {
button {
font-size: 1.75rem;
border: 0;
background: white;
cursor: pointer;
display:block;
}
button:focus {
outline: 0;
}
nav div#navigation {
right: 0;
}
nav li {
display: block;
border: solid 1px blue;
margin: 0 auto;
}
#links {
display: none;
background-color: white;
}
button:focus + #links,
#links:hover {
display: block;
position: absolute;
right: 5vw;
}
nav {
color: blue;
}
section > h1 {
margin-top: 6.25vh;
color: blue;
}
nav header > h1 {
margin: 0;
padding: 0;
font-size: 2rem;
}
}
Demo
I have in text paragraphs some rather large portions of underlined texts. Many of them go over several lines.
Within those underlined elements, in some cases I have elements that should be underlined themselfes. Here, the underline of the outer underlined element should go a little down in order to make the underline of the inner underlined elments visible. Look at the third line of my mockup and you will understand what I mean (at least I hope so). "querit" and "Epicurae" are underlined within underlined elements.
How can I achieve this in CSS? With text-decoration: underline the underlines collapse and you won't see which elements are nested underlined elements. On the other hand, display:inline-block; border-bottom:1px solid black; will just underline the last line.
Edit: The HTML for this mockup would look like this: (not particulary interesting, I guess)
<p> de con firt omniandabetisporatienimusi remprobist extrum etis e ipsaenderienimagnos <span class="underlined">quibus quidas mus, ines, quam Solostracum met ipsa horum mum, esispotatus con ipid inprobus, que vollin que <span class="underlined">querit</span> pus nego mo <span class="underlined">Epicurae</span> id sitam mod etia et nectuas ent malosse te. quitus, essendolinxet ob utrus aleganesserisimone ne nitae lium vitae; Metisquiamquae sid los plego ilius, andus adexperibus vitur. quod dictantum alt, num Toriae</span> conc ocorturaec </p>
Just don't use display: inline-block. Say, we are using the tag <span class="und"> for underlining something. For a nested one, use something like this:
/* Start Praveen's Reset for Fiddle ;) */
* {font-family: 'Segoe UI'; margin: 0; padding: 0; list-style: none; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;}
body {margin: 15px;}
/* End Praveen's Reset for Fiddle ;) */
p {margin: 0 0 10px;}
.und {border-bottom: 1px solid; padding: 2px;}
.und .und {border-bottom: 1px solid; padding: 0;}
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Maxime, cumque! Facere iste, adipisci non quam molestias modi! Reprehenderit, quo officia est voluptatibus eum omnis magni voluptate. Similique, voluptatibus quasi dolore!</p>
<p><span class="und">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Neque quo ea natus deserunt praesentium laudantium similique, officia sequi unde provident quasi aliquid iure, tempora sunt quod doloremque, dolor. Voluptate, tempora! <span class="und">This is double underlined and doesn't break!</span> Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolor commodi adipisci similique eligendi a praesentium officia repudiandae quaerat ipsum placeat natus nemo, sit magnam laborum error vero, ullam officiis veniam!</span></p>
Nested Items
/* Start Praveen's Reset for Fiddle ;) */
* {font-family: 'Segoe UI'; margin: 0; padding: 0; list-style: none; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;}
body {margin: 15px;}
/* End Praveen's Reset for Fiddle ;) */
p {margin: 0 0 10px; line-height: 1.5;}
.und {border-bottom: 1px solid; padding: 4px;}
.und .und {border-bottom: 1px solid; padding: 2px;}
.und .und .und {border-bottom: 1px solid; padding: 0;}
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Maxime, cumque! Facere iste, adipisci non quam molestias modi! Reprehenderit, quo officia est voluptatibus eum omnis magni voluptate. Similique, voluptatibus quasi dolore!</p>
<p><span class="und">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Neque quo ea natus deserunt praesentium laudantium similique, officia sequi unde provident quasi aliquid iure, tempora sunt quod doloremque, dolor. Voluptate, tempora! <span class="und">This is double underlined and <span class="und">triple consectetur adipisicing</span> doesn't break!</span> Lorem ipsum dolor sit amet, elit. Dolor commodi adipisci similique eligendi a praesentium officia repudiandae quaerat ipsum placeat natus nemo, sit magnam laborum error vero, ullam officiis veniam!</span></p>
I am using Chrome and Safari, in neither of them the attribute shape-outside seems to work. I've put both the -webkit and the normal version.
.circle {
background-color: #f3a57b;
border-radius: 50%;
width: 150px;
height: 150px;
-webkit-shape-outside: circle(50%);
float: left;
}
.text {
float: left;
width: 500px;
}
<div class="circle"></div>
<p class="text">Some Text Here</p>
I want to get the text to adapt to the circle like this:http://codepen.io/adobe/pen/Cnvuf
If you remove float:left from .text, you'll see that it works:
.circle {
background-color: #f3a57b;
border-radius: 50%;
width: 150px;
height: 150px;
-webkit-shape-outside: circle(50%);
shape-outside: circle(50%);
float: left;
}
<div>
<div class="circle"></div>
<p>Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit Neque porro quisquam est qui dolorem Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit Neque porro quisquam est qui dolorem Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit Neque porro quisquam est qui dolorem Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit Neque porro quisquam est qui dolorem Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit Neque porro quisquam est qui dolorem Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit Neque porro quisquam est qui dolorem Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit Neque porro quisquam est qui dolorem Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit Neque porro quisquam est qui dolorem</p>
</div>
JSFiddle
As for Firefox and IE, it's not supported (Note: Safari version 8.0).
As you can see here, Safari doesn't support this feature. And chrome only support it with the 'experimental Web Platform features' enabled.
And I think you can enable this only with Chrome canary.