Jump to content

Span with paragraph to create two columns


OAFC_Rob

Recommended Posts

Hi,

 

I have a paragraph of text that basically needs a label that is split into two columns for 100% width and 100% height. The label column needs to be a set minimum withd of 6.5em to cope for the longest labelling. I have tried a few different things and cannot figure out the best course of action. This is the best I've got so far;

<p>
<span>My Label</span>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
p {
width: 100%;
}
p span {
min-width: 6.5em;
float: left;
min-height: 3em; 
}

The issue I have is I can set the height to a fix width which give me my desired effect, but it isn't responsive at all any help would be appericated.

Link to comment
Share on other sites

You might want to encapsulate the span and p with a div.  I put a calc function to p width also. I tried this and it seems to work:

p {
float:left;
width: 100%;
 width: calc(100% - 6.5em);
}

p span {
min-width: 6.5em;
float: left;
min-height: 7em; 
}

.together{min-height:3em;}

Something like this:

<div class="together">
<p>
<span>My Label</span>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat 
</p>
</div>
<div class="together">
<p>
<span>My Label</span>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</div>
Edited by possien
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.